我遵循在ready
内调用的ajax请求。
$.ajax({
url: 'http://otherurl.com',
username: 'user',
password: 'pwk',
type: 'GET',
xhrFields: {
withCredentials: true
},
crossDomain:true,
dataType:"json",
success: function (data) {
console.log(data)
},
error: function (a, b, c) {
console.log("a", a);
console.log("b", b);
console.log("c", c);
}
});
当我在chrome中打开页面时,请求会转到服务器,我会看到弹出窗口提供用户名和密码(提供的凭据无效)。如果我输入凭据一次,ajax请求之后工作正常,直到我清除浏览历史记录。
在Firefox和IE中,ajax请求永远不会发送到服务器,并始终以ready = 0
的错误回调结束。我怎么解决这个问题?