i have always the same problem, it is hard for me to read the reply from a json post.
For example
$.getJSON('http://gdata.youtube.com/feeds/api/users/live/subscriptions?alt=json', function(data) {
$.each(data.feed.entry, function(i, item) {
console.log(item.feed.link.i); // did not work
});
});
The Reply
{"version":"1.0","encoding":"UTF-8","feed":{"xmlns":"http://www.w3.org/2005/Atom","xmlns$openSearch":"http://a9.com/-/spec/opensearchrss/1.0/","xmlns$gd":"http://schemas.google.com/g/2005","xmlns$yt":"http://gdata.youtube.com/schemas/2007","id":{"$t":"http://gdata.youtube.com/feeds/api/users/live/subscriptions"},"updated":{"$t":"2011-03-04T08:31:20.148Z"},"category":[{"scheme":"http://schemas.google.com/g/2005#kind","term":"http://gdata.youtube.com/schemas/2007#subscription"}],"title":{"$t":"Subscriptions of live","type":"text"},"logo":{"$t":"http://www.youtube.com/img/pic_youtubelogo_123x63.gif"},"link":[{"rel":"related","type":"application/atom+xml","href":"http://gdata.youtube.com/feeds/api/users/live"},{"rel":"alternate","type":"text/html","href":"http://www.youtube.com/profil ....
Sometimes i need an hour to get it -.- ...
How do you read this? Any nice ideas?
Thanks in advance!
Peter
When I ran the code you pasted in my Firebug console without the feed
I saw this object model:
So as you can see feed
is not a child of item
, and that's why you were getting an error.
Try this instead
$.getJSON('http://gdata.youtube.com/feeds/api/users/live/subscriptions?alt=json', function(data) {
$.each(data.feed.entry, function(i, item) {
console.log(item.gd$feedLink); // did not work
});
});