119
rated 0 times
[
120]
[
1]
/ answers: 1 / hits: 20517
/ 14 Years ago, tue, september 21, 2010, 12:00:00
Ok, a little new to JSON format..
I have the following JSON string returned from an AJAX call, which firebug actually displays in a tree quite nicely.. however I can't seem to be able to work out how to loop through the content...
{data:{item:[{@id:7,fromMemberID:7,FromMember:david,notificationsType:event,notificationsDesc:A new event (Test Event Thursday, 16 September 2010) has been created.,notificationsDate:16 Sep 2010,notificationsTime:00:02:18},{@id:8,fromMemberID:7,FromMember:david,notificationsType:event,notificationsDesc:A new event (Test Event Thursday, 16 September 2010) has been created.,notificationsDate:16 Sep 2010,notificationsTime:08:26:24}]}}
I have tried to say get a count of items.. alert(data.item.length);
or a loop:
for(i=0; i<data.item.length; i++)
{
alert(data.item[i].FromMember);
}
obviously missing something fundemental...
Any ideas??
More From » json