jQuery.getJSON Acess Denied
jQuery.support.cors = true;
$.getJSON('https://gdata.youtube.com/feeds/api/videos/' + vid + '?v=2&alt=json',YoutubeBookmarklet.handle_gdata_obj)
.error(function(xhr, ajaxOptions, thrownError) {
console.log(thrownError);
开发者_StackOverflow社区});
The first error I got was "No Transport",by the help of stackoverflow I saw that I need to add jQuery.support.cors = true in order to fix it,after adding it I am getting another error : "Access is denied."
I tried to use the IE XDomainRequest,but I get the same error.
What to do?I fixed it using JSONP in order to do so i added "&callback=?" to the end of the url.
Looks like a cross domain call, take a look at this hope it will help you.
http://james.padolsey.com/javascript/cross-domain-requests-with-jquery/
精彩评论