I’ve got my scribd xml feed (with its secret pass key hidden) converted to JSON via YQL.
I want to use jQuery to populate an unordered list with the results. It’s working in everything but IE.
This seems pretty barebones to me, and yet I can’t understand why it achieves nothing in Internet Explorer. There must be some IE secret I don’t know about, like JSON is handled differently in IE, or you need to use JSONP, or IE doesn’t play nice with this usage of .each()… What am I missing here? Here’s a jFiddle Link to demonstrate: http://jsfiddle.net/niceindividual/nRkvS/2/
var yqlURL = "http://query.yahooapis.com/v1/public/yql/dulyb/scribdCHF?format=json";
window.console.log("The yqlURL variable is set to " + yqlURL);
$.getJSON(yqlURL, function(data) {
$.each(data.query.results.result, function() {
$('#results').append('<li><div><a href=\"http://www.scribd.com/doc/' + this.doc_id + '\">' + '<img src=\"' + this.thumbnail_url + '\" />' + '<span>' + this.title + '</span></div></a><p>' + this.description + '</p></li>');
});
});
My friend Raymon helped me out:
YQLoutputsJSONP, notJSON;so in the code above, I used$.ajaxinstead of$.getJSONand set thedataTypeto “jsonp“. It seems to work in IE now.Updated (fixed) Example: http://jsfiddle.net/niceindividual/nRkvS/4/