7

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 both work as expected, but IE keeps triggering the error function (when using $.ajax) instead of success. The error status is "0" which doesn't help much.

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

Any ideas?

1
  • I have heard that IE can be very aggressive in its caching; if you clear the cache and then try your code again, does it succeed? Commented Jun 11, 2011 at 23:33

1 Answer 1

21

I can't tell you if it's an error in jquery or IE, but it looks like the XDomainRequest fails in IE. Add this to the URL:

&callback=?

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

Edit: It looks like Microsoft's XDOmainRequest is not implemented in jQuery, so you can't run Cross-Domain-Requests in jQuery using IE(except jsonp)

Sign up to request clarification or add additional context in comments.

2 Comments

This answer just changed my life :)
Really! you saved me from goolging for another don't know how many days!!!

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.