Skip to Navigation or
Skip to Content

AJAX Ready State Codes

Feeds

RSS Feed

<< March | April | May >>

Friday, 23rd April 2010

If you are hand-cranking an AJAX request, you'll be looking for a Ready State of 4 and a Status of 200. But what other Ready States are there and what do they mean?

request.onreadystatechange = function () {
    alert("readyState: " + request.readyState);
};

0. Uninitialized

1. Set up, but not sent

2. Sent

3. In flight

4. Complete

It is only when the readyState is Complete that you normally bother to check the Status code, which is a standard HTTP header (200 for OK).

 

You Are Here: Home » Blog » AJAX Ready State Codes

 

I use a cookie on this website. This cookie doesn't contain or relate to any personal information and it isn't shared with any other website, it just ensures that I don't count you more than once in my website statistics. The Privacy and Electronic Communications Regulations require me to ask your permission to use this cookie, so please indicate below that you are happy for me to do this - I will remember your selection with a cookie, so if you accept I won't ask again...