【问题标题】:JQuery Ajax Error on Internet ExplorerInternet Explorer 上的 JQuery Ajax 错误
【发布时间】:2014-07-07 16:01:39
【问题描述】:

我正在发出一个 Ajax 请求,它在所有浏览器中都可以正常工作,但在 Internet Explorer 中却无法正常工作。我需要适用于 Internet Explorer 9 +

这就是请求:

function loadYoutubeVideos(youtubeUrl){
var url = 'youtubeUrl';
$.ajax({
    type: 'GET',
    dataType: "json",
    url: url,
    success: function (responseData, textStatus, jqXHR) {
        objYoutubeVideos = responseData;
        //more functions, blablabla

    },
    error: function (responseData, textStatus, errorThrown) {
        console.log(textStatus, errorThrown);
        //error functions
    }   
});
}

我正在编写一些代码来加载 Facebook 页面内容。我该怎么办?

【问题讨论】:

  • 错误是什么? 什么不起作用?
  • IE 不喜欢跨域 ajax 请求...您应该对服务器执行 ajax 调用,然后从服务器发送 api 请求并将结果通过管道传回客户端。 stackoverflow.com/questions/3362474/…

标签: javascript jquery ajax internet-explorer


【解决方案1】:

您是否尝试过使用jsonp 格式?

json 格式在跨域(不同域)使用时存在问题。

所以,你需要使用jsonp而不是jsonjsonp使用javascript回调来解决跨域问题。

更多:http://www.sitepoint.com/jsonp-examples/


您不需要为 api 请求创建管道。

Youtube 支持jsonp 格式使用&callback= 参数。

【讨论】:

    猜你喜欢
    • 2013-08-22
    • 2012-05-30
    • 2012-11-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-15
    • 2011-07-24
    相关资源
    最近更新 更多