Ajax on ready statechange

Education is not limited to just classrooms. It can be gained anytime, anywhere... - Ravi Ranjan (M.Tech-NIT)

Ajax on ready state change Event Of XML Http Request Object

Once the request been sent to the server,  changes will happen in the current webpage based on the response only.  The onreadystatechange event will be triggered every time the readyState changes.

Here the properties of XMLHttpRequest object


A function will be stored and will be called automatically each time readyState property changes


0 – request not initialized
1 – connection been established with the server
2 – request received from the server
3 – request being processing
4 – request finished and response is ready


200 : ok
404 : page not found, it’s normal 404 error

So, readyState = 4  & status = 200 then every thing will be perfect, i mean we got the response from the server, and  our webpage will be modified with the response text/xml.