I cannot figure out json for whatever reason, i don’t understand why i cannot get this to work.
my json is returning:
{"lists":[{"item":"1","count":"5"}]}
{"lists":[{"item":"1","count":"5"}]}
{"lists":[{"item":"1","count":"5"}]}
{"lists":[{"item":"1","count":"5"}]}
{"lists":[{"item":"1","count":"5"}]}
etc, etc, etc
now i am trying to retrieve it by using:
$.getJSON("lists.php",
{id: aid},function(data){
$.each(data.lists, function(i, info) {
$('.container').append(info.item+info.count);
});
});
but i don’t get any data here. can anyone point me in the right direction?
});
It looks like you’re used to how URL parameters are encoded. JSON works differently.
If you want your object to contain a key
listswhich contains an array, you should return JSON like this: