简体   繁体   中英

jQuery Ajax cors IE10 not working

I'm using jQuery to do a post request to a different domain. This works fine on FF, Chrome and IE7,8 and 9. I was not expecting not to work on IE10..any ideas? Here's the code

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);
    }
});

Maybe security zones in IE has something to do with it? https://msdn.microsoft.com/en-us/library/ms537505(VS.85).aspx#xdomain

Tldr; It is possible that IE will not allow CORS, if it uses Native XMLHTTP, and if the two domains are in certain different security zones.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM