I’ve implemented ajax call using jQuery and in case of error, I could look for textStatus to determine whether the error is “timeout”, “error”, “abort”, “parseerror”.
But what does “error” really stands for? 404(not found)? 408(timeout)?
code:
$.ajax({
url: "../resources/plan/get/" + planno,
type: "get",
dataType: "html",
timeout: 5000,
success: function(data, txtStat, xhr) {
console.log("success:" + txtStat);
},
error: function(xhr, txtStat, errThrown) {
if(txtStat === "timeout") {
console.log("ajax has timed-out! " + txtStat + ":::" + errThrown);
}
else if(txtStat === "error") {
//so..what is error means???
}
//TODO write else..
}
});
I wonder if it is everything other than HTTP 200?
I would guess everything except 200. Can’t you look at
xhr.statusto see what error code the server returned?