readyState represents the current status of an AJAX request.
It tells us how far the request has progressed between browser and server.
The readyState value changes automatically during the AJAX process.
There are five readyState values from 0 to 4.
When readyState is 0, the request object is created but not opened.
When readyState becomes 1, the open method has been called.
When readyState reaches 2 and 3, the request is sent and data is being processed.
When readyState becomes 4, the response is fully received from the server.
Most developers check readyState 4 along with status 200 to ensure success.
Using readyState properly helps control when data should be processed.