$('document').ready(function()
{
$.getJSON('news.php', parseInfo);
});
function parseInfo(data)
{
alert(data.news);//undefined
$('#info').html(data.news);
}
My PHP output(news.php) is [{"id":"20110428","news":"april 28 2011"}]
Your object is wrapped inside an array.
You need data[0].news
Alternatively remove the outer square brackets from your JSON output.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With