I'm trying to get a json object from php so I can work with it in ajax. Here is my ajax code:
$.ajax({
type: 'get',
url: eventsListPath,
dataType : "json",
data: {},
success: function (data) {
$('#eventInformation').html(data.table);
alert(data.table);
}
});
And my PHP:
$obj->table="hey";
echo json_encode($obj, JSON_UNESCAPED_SLASHES);
But the line
alert(data.table);
comes back with 'undefined'. Any ideas?
console.log(data)insuccess. Tell me the result.