Jquery $ .get或$ .ajax在Internet Explorer中不起作用

use*_*200 8 ajax jquery internet-explorer

我一直在IE 9中运行此代码而没有运气.我查看了有关UTF-8修复的所有帖子,但无济于事.有什么想法吗?

$.get({
    url: 'http://api.flickr.com/services/rest/?api_key={apikey}&method=flickr.collections.getTree&user_id=66970820%40N03&collection_id=66947766-72157631850748939',
    success: function () {
        console.log('success!');
    }
}).done(function () {
    console.log('done');
}).fail(function () {
    console.log('fail')
});
Run Code Online (Sandbox Code Playgroud)

它在Safari,FF和Chrome中运行得很好.将URL粘贴到IE中时,响应很好.

use*_*200 4

@Iden Gozlan,你的回答听起来不错,但我脆弱的头脑感到困惑。

@Erik 和 @charlietfl 您对 JSONP 的建议让我走上了正确的道路。这绝对是一个跨域脚本问题。不明白为什么 IE 是唯一不允许这样做的。我这样编辑了我的代码,一切都很好!

$.ajax({
  url: 'http://api.flickr.com/services/rest/?api_key={apikey}&method=flickr.collections.getTree&user_id=66970820%40N03&collection_id=66947766-72157631850748939&jsoncallback=doSomeGreatStuff',
  dataType: "jsonp"
});

function doSomeGreatStuff(response) {
  // do some great stuff with the json response
  console.log( response.collections.collection[0].id );
}
Run Code Online (Sandbox Code Playgroud)

对我有帮助的资源在这里这里甚至这里