There are 3 important properties of the XMLHttpRequest object
The onreadystatechange property stores the function that has to run when we receive the response from the server or web service.
The readyState property stores the state of the XMLHttpRequest object.
Its values can be:
0: request not initialized
1: server connection established
2: request received
3: processing request
4: request finished and response is ready
The status property indicates whether the request was successfully executed (200) or if there is an error (404)
Possible values for status
404: Page not found
When readyState is 4 and status is 200, the response is ready.
Example of using events and properties: