I have some json data I retrieve from php code by a jquery $.post() request. The format is json. But the data is not processed on my brower when the callback function is called
$.post(url_send, data_to_send, function(callback_data){
var info = callback_data.info;
console.log(callback_data.info);
...
});
callback_data = {"success":[{"id":some_number}],"info":"some_string"}
To debug, I noticed that : if I put in this code console.log(callback_data); the right json data displays in my console, but if I let console.log(callback_data.info), the console displays 'undefined'. Could someone explain that?
Edit : in my php I have $reply = array(‘success’ => $ids,’info’ => $info); echo json_encode($reply);
callback_data will be in string format you have to convert it to json using eval to use it as an object.. once you do the eval you should have callback_data.info something like this