Web Technologies

In Ajax call, What is the meaning of different readyState property values? – Tutorial 4

For readyState property, we have 5 different values.

0 meaning UNSET – xhr.open() is not yet called.

1 meaning OPEN – xhr.open() method is called.

2 meaning HEADER RECEIVED – Server received the request

3 meaning LOADING – Server is busy to processing

4 meaning DONE- Boommm!

Browser care about only 2,3 & 4. That is why the onreadyStatechnage property (which is a callback function) only runs on the readyState property value for 2,3 & 4.

Next lession