Hello, I've noticed this weird behaviour of jQuery in Safari. After setting up the call like this:
$.ajax( {
'url' : url,
'dataType' : 'json',
data : reqdata,
timeout: 20000, //10 secs of timeout
success : function(data, textStatus, XMLHttpRequest) {
console.log("success");
if ((data === null) || (data.length == 0)) {
ts.doAction( {
'actionName' : 'timeout',
'request' : {
'reqdata' : reqdata,
'actionName' : actionName,
'url' : url
},
'controller' : ts
});
}
ts.doAction( {
'actionName' : actionName,
'data' : data
});
},
error : function(XMLHttpRequest, textStatus, errorThrown) {
console.log("error: " + textStatus);
if (textStatus == "timeout") {
ts.doAction( {
'actionName' : 'networkFailureError',
'request' : {
'reqdata' : reqdata,
'actionName' : actionName,
'url' : url
},
'controller' : ts
});
} else {
ts.doAction( {
'actionName' : 'serverError',
'request' : {
'reqdata' : reqdata,
'actionName' : actionName,
'url' : url
},
'controller' : ts
});
}
}
});
If a timeout occurs (I switch the local webserver off), the 'success' method will be called! More than this in the textStatus parameter there is a string with "success" !!! The error handler doesn't even get called.... (As you may notice the only way I had to tell the problem, was to check the data param if it is null or 0 length... Why this behaviour? How can I avoid this?