JQuery.getJSON does not work properly in IE8 with gdata json-c. What for?

Using jQuery:

$.getJSON('http://gdata.youtube.com/feeds/api/videos/b2-5GSjZvW8?v=2&alt=jsonc', function(meta){alert(meta.data.title);}); 

Firefox and Chrome work as expected, but IE continues to run the error function (when using $.ajax ) instead of success. The error status is "0", which does not help much.

I also tried using $.ajax with cache:false no avail.

Any ideas?

+7
source share
1 answer

I can't tell you if this is a bug in jquery or IE, but it looks like XDomainRequest is failing in IE. Add this to the url:

 &callback=? 

... so the response will be processed as jsonp.

Edit: It seems that Microsoft XDOmainRequest is not implemented in jQuery, so you cannot run cross-domain queries in jQuery using IE (except jsonp)

+21
source

All Articles