I'm very new to Ajax and started with a tutorial given at http://www.ibm.com/developerworks/library/j-ajax1/. . But instead of working on Shopping cart example, I replaced that with a TimeServlet that returns the current time. Servlet is working fine and I'm pasting any details about it here.
But below are my ajax calls
I'm calling getTime() function on onload event of the webpage. I'm getting response properly as expected. To trace the call, I used alert statement displaying the request.readyState and what I noticed in getReadyStateHandler() function, it get started with readyState as 1 and does not go in sequence like 1, 2, 3, 4 , instead I see 1, 2, 4 and 3.. and some times 1,2,3, 4,4 .. Is there any error in the way I'm making the ajax calls. Or I don't have to worry about the calls. Please advise.