I have the following code:
script.js:
function maisDetalhes(id){
$.ajax({
url:'paginaDados.php',
type:'GET',
data:'id='+id,
dataType:'json',
success:function(data){
alert(data.id_event);
}
});
and pageDados.php:
foreach ($Dados as $Linhas) {
$resultado = array("id_evento" => $Linhas['id_event'],
"nome_evento" => $Linhas['event_name'] );
}
echo json_encode($resultado);
exit();
But in the ajax success function, I am not able to receive the data, when I give the alert it shows 'undefined', when I write only alert (data) it appears everything, however I would like to take the data separately, as Can I do it?
Thank you in advance!