Rushikesh jogle
Rushikesh jogle

Reputation: 591

Retrieving youtube playlist info using JSON not working on IE

Below code is working on chrome and mozilla but this is not working on IE 8.

Could you help me out ..

var video_id='VA770wpLX-Q';

$.getJSON('http://gdata.youtube.com/feeds/api/videos/'+video_id+'?v=2&alt=jsonc',function(data,status,xhr){
alert(data.data.title);
});

Upvotes: 0

Views: 583

Answers (1)

Andreas Schwarz
Andreas Schwarz

Reputation: 1798

This is because IE (until IE 10) does not support Cross-Domain Resource Sharing.

tkonegives a good explanation here: getJSON is not Working in IE for Youtube. Unfortunately the solution he offers (add a ? at the end of the URL) does not work.

There are other solutions, an easy one would be to add &callback=?at the end of your URL, as suggested by Yosy:

$.getJSON('http://gdata.youtube.com/feeds/api/videos/'+video_id+'?v=2&alt=jsonc&callback=?',
    function(data,status,xhr){
        alert(data.data.title);
});

Upvotes: 1

Related Questions