【问题标题】:jQuery Ajax cors IE10 not workingjQuery Ajax cors IE10 不工作
【发布时间】:2014-01-05 04:28:04
【问题描述】:

我正在使用 jQuery 向不同的域发出 post 请求。这在 FF、Chrome 和 IE7、8 和 9 上运行良好。我没想到不能在 IE10 上运行..有什么想法吗?这是代码

var url = "http://xxxxxxx/xxxx.php?";

jQuery.ajax({
    type: "POST",
    async: false,
    crossDomain: true,
    contentType: "application/json; charset=utf-8",
    url: url,
    dataType: "json",
    data: JSON.stringify(params),
    success: function (data) {
        callback.call(Test, data, optional);
    },
    error: function ( jqXHR,  textStatus,  errorThrown) {
        alert(textStatus + errorThrown);
    }
});

【问题讨论】:

标签: javascript jquery ajax internet-explorer cors


【解决方案1】:

也许 IE 中的安全区域与此有关? https://msdn.microsoft.com/en-us/library/ms537505(VS.85).aspx#xdomain

Tldr;如果 IE 使用 Native XMLHTTP,并且如果两个域位于某些不同的安全区域中,则 IE 可能不允许 CORS。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-08-17
    • 2013-09-16
    • 2016-09-23
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多