【问题标题】:Cross Domain AJAX call not working in IE11跨域 AJAX 调用在 IE11 中不起作用
【发布时间】:2019-02-11 20:48:11
【问题描述】:

我正在尝试进行跨域 AJAX 调用。它适用于 Chrome 和 Firefox,但不适用于 IE11。 IE11 似乎放弃了 AJAX 调用。 IE11 开发者工具网络显示,甚至没有向 url 发出请求。这是我拥有的代码的 sn-p。

$(function() {
  var url = "https://example.com?abc=xyz";
  $.ajax({
    type : "GET",
    contentType : "text/plain",
    url : url + "&callback=?",
    dataType : 'jsonp',
    xhrFields : {
        withCredentials : false
    },
    headers : {},
    success : function() {
        console.log("success");
    },
    error : function() {
        console.log("error");
    },
    complete : function() {
        console.log("complete");
    }
  });
});

【问题讨论】:

    标签: ajax cross-domain internet-explorer-11


    【解决方案1】:
    $.ajax({
        type : "GET",
        cache: false,
    

    或在 ajax 调用之前

       $.ajaxSetup({ cache: false });
    
       $.ajax({
        type : "GET",
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-06-22
      • 2014-03-29
      • 2012-10-09
      相关资源
      最近更新 更多