Take the 2-minute tour ×

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)?


        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?

share|improve this question
add comment

1 Answer

up vote 3 down vote accepted

I would guess everything except 200. Can't you look at xhr.status to see what error code the server returned?

share|improve this answer
That's actually good point! I will take a look! thx :) –  masato-san Jan 30 '12 at 10:08
In case of error, xhr.status and xhr.readyState both returned 0 –  masato-san Jan 30 '12 at 10:11
Oh.. I'm sorry it wasn't case of error, it was case of "timeout".. I must change my server code to return like 500 to test this. –  masato-san Jan 30 '12 at 10:13
Ok... I changed server code to return 404, and xhr.status = 404 and xhr.readyState = 4 were returned. I think that would be the way to determine. Thanks for the insight. –  masato-san Jan 30 '12 at 10:18
add comment

Your Answer


