Surendra Singh Surendra Singh - 1 year ago 65
Javascript Question

What is meaning of xhr.readystate===4

Is it right to say that the AJAX call has completed after


Here it says the state is
. So what does this

Answer Source

A http request in Ajax term has 5 states as your reference document:

0   UNSENT  open() has not been called yet.
1   OPENED  send() has been called.
2   HEADERS_RECEIVED    send() has been called, and headers and status are available.
3   LOADING Downloading; responseText holds partial data.
4   DONE    The operation is complete.

State 4 mean that the request has been sent and server finish returning the response and browser has finished download the response content. So, it is right to say that AJAX call has completed.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download