IOS 8.1 Safari:$.ajax 给出超时错误 dom 异常 23
IOS 8.1 Safari:$.ajax giving timeout error dom exception 23
我正在使用 iPhone 5S,iOS 版本 8.1。当我调试具有一些 jquery ajax 调用的 Web 应用程序时,我一直在执行 error
回调方法。我还尝试将超时指定为高值(如 20,000 毫秒),如下所示:
$.ajax({
type: "POST",
url: serviceURL,
data: userInputjson,
contentType: "application/json; charset=utf-8",
datatype: "json",
async: false,
timeout: 20000,
complete: function (msg) {
if(msg.responseJSON) {
msg = msg.responseJSON;
alert('msg.responseJSON exists');
console.log(msg);
if (msg.Status == 'SUCCESS') {
var obj = JSON.parse(userInputjson);
var firstName,lastName,email;
for(i=0; i< obj.fields.length; i++){
if(obj.fields[i].Key =="FirstName")
{
firstName = obj.fields[i].Value;
}else if(obj.fields[i].Key =="LastName"){
lastName = obj.fields[i].Value;
}else if(obj.fields[i].Key =="Email"){
email = obj.fields[i].Value;
}
}
alert("before cookie");
$.cookie(DHLoginCookieName, {
firstName: firstName,
lastName: lastName,
emial:email,
isLoggedIn: true
});
alert("after cookie");
window.top.location.href = "thankyou.html";
}
else
{
alert("in else");
$(".regLoader").hide();
$("#submiterror").show();
}
return false;
}
},
error: function (xmlHttpRequest, textStatus, errorThrown) {alert("Error status 2: "+textStatus+"\n"+errorThrown);
if (xmlHttpRequest.readyState == 0 || xmlHttpRequest.status == 0) {
$(".regLoader").hide();
$("#submiterror").show();
return ;
}
}
})
没有任何影响。
任何人请告诉我我这边可能出了什么问题。
将 async: false 更改为 async: true ,可能会有帮助
我正在使用 iPhone 5S,iOS 版本 8.1。当我调试具有一些 jquery ajax 调用的 Web 应用程序时,我一直在执行 error
回调方法。我还尝试将超时指定为高值(如 20,000 毫秒),如下所示:
$.ajax({
type: "POST",
url: serviceURL,
data: userInputjson,
contentType: "application/json; charset=utf-8",
datatype: "json",
async: false,
timeout: 20000,
complete: function (msg) {
if(msg.responseJSON) {
msg = msg.responseJSON;
alert('msg.responseJSON exists');
console.log(msg);
if (msg.Status == 'SUCCESS') {
var obj = JSON.parse(userInputjson);
var firstName,lastName,email;
for(i=0; i< obj.fields.length; i++){
if(obj.fields[i].Key =="FirstName")
{
firstName = obj.fields[i].Value;
}else if(obj.fields[i].Key =="LastName"){
lastName = obj.fields[i].Value;
}else if(obj.fields[i].Key =="Email"){
email = obj.fields[i].Value;
}
}
alert("before cookie");
$.cookie(DHLoginCookieName, {
firstName: firstName,
lastName: lastName,
emial:email,
isLoggedIn: true
});
alert("after cookie");
window.top.location.href = "thankyou.html";
}
else
{
alert("in else");
$(".regLoader").hide();
$("#submiterror").show();
}
return false;
}
},
error: function (xmlHttpRequest, textStatus, errorThrown) {alert("Error status 2: "+textStatus+"\n"+errorThrown);
if (xmlHttpRequest.readyState == 0 || xmlHttpRequest.status == 0) {
$(".regLoader").hide();
$("#submiterror").show();
return ;
}
}
})
没有任何影响。
任何人请告诉我我这边可能出了什么问题。
将 async: false 更改为 async: true ,可能会有帮助