I am using a iPhone 5S, with iOS version 8.1. When I debug my web application having some jquery ajax calls, I am consistently getting my error
callback method executed. I also tried to specify timeout to a high value (like 20,000 ms) like this:
$.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 ;
}
}
})
with no effect, whatsoever.
Anybody please tell me what could be wrong on my end.
change async: false to async: true , it may help