I get this error in the console using JSFiddle and Chrome: http://jsfiddle.net/YdM8n/2/ when trying to parse a Flickr feed with jQuery.
Code:
// a flickr rss feed i am trying to parse.
var yql3 = "http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20xml%20where%20url%3D%22http%3A%2F%2Fapi.flickr.com%2Fservices%2Ffeeds%2Fphotos_public.gne%3Fid%3D76250020%40N04%26lang%3Den-us%26format%3Drss_200%22&format=json&diagnostics=true&callback=?";
$.getJSON(yql3, function(cbfunc) {
var eachImageArr = $(cbfunc.query.results.rss.channel.item);
$(eachImageArr).each(function() {
$('body').append(this.description);
});
});
Thanks for your help!
If you look at the actual JSON returned, you’d notice the possible format of the
descriptionitem can be:When looping through every description, you can check to see if it’s an array, if and if it is, append the
[0]index to the body. Something like:http://jsfiddle.net/YdM8n/5/
But obviously the API needs investigated more to make sure other special cases can’t occur…or at least try to account for something similar.