Get all updates of Java4s
Follow Us: Email Newsletter

Ajax onreadystatechange Event Of XMLHttpRequest Object

Ajax » On Oct 5, 2011 { 11 Comments } By Sivateja

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.


You Might Also Like

  ♦ About Author ♦

Full Stack( Java/J2EE & UI/UX ) Developer and founder of Java4s - Get It Yourself, A popular Java/J2EE Programming Blog. Sign-up for the Email Newsletter for your daily dose of Java tutorials.


11 Responses to “Ajax onreadystatechange Event Of XMLHttpRequest Object”
  1. Stacy Montooth says:

    I genuinely appreciate your work , Great post.

  2. sankar says:

    10q…..ajax tutorial is awesome and easy to learn….once again my heartfull 10qssssssss

  3. Sk.Gopinath says:

    I think this is the best site to learn ajax ….awesome ….. Thank u friend..

  4. tnx Siva Teja. dis is d easiest way to learn ajax …awesome..THE BEST..

  5. Adireddy says:

    Thank you team. Ajax info is useful.

  6. kamala says:

    great Siva…its a nice website to learn Ajax and other technology related to Java…
    keep on.. share your knowledge..
    if u give some java related project scenario and also code to write..then most java learner will get benefited.

  7. nagababu says:

    I wnat to get the data from database, and insert into database and delete from the data base using ajax and servlets……………..
    How can i do?

    database table name:dept(dname, description)
    1. display results using check box
    2. If i click on more than one check box then it will be deleted from browser display results as well as deleted from the database also…………

  8. G Chenna Kesava Reddy says:

    Thank u so much we are providing best services to the all employees and students who are really searching for the job

  9. vinod says:

    Hello sir onreadystatechange is listener or event. Because from some site I read it is a listener register with XMLHttpRequest object. If any event occur on this object the listener will be invoked. Plz explain.

  10. Manish Mishra says:

    I really want say thanks from bottom heart .you did great job .
    thank you so much.



By posting your answer, you agree to our comments policy.
What would you like to learn today?
Browse these popular technologies
Hibernate spring struts Servlets ajax Log4j jQuery Json Core Java Web Services AngularJs
Most Recent Tutorials
Hibernate_Logo Hibernate Recent Posts Spring_Logo Spring Recent Posts Struts_Logo Struts Recent Posts
Useful Links Current & UpComing Tutorials
  Web Services [ SOAP ], JSP
Contact | About Us | Privacy Policy | Advertise With Us

© 2010 - 2016 Java4s - Get It Yourself.
The content is copyrighted to Sivateja Kandula and may not be reproduced on other websites.