This week's book giveaway is in the Java in General forum. We're giving away four copies of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 and have ishori Sharan & Adam L Davis on-line! See this thread for details.
I am using AJAX at client side to make calls(POST calls) to multiple servlets of the same app. The spec requires an AJAX call to wait for some event to happen(at the server side) before this call completes. Meanwhile other AJAX calls are being made to some OTHER servlet(s) all of which get completed immediately.
The latter calls returns some data on completion without a hitch. However, when the former(the one which was waiting for an event) completes, it "tries" to return some data too, but it returns the output of the latter calls and that too more than once.
I am using POST for all these calls and suspect that "constant-handshaking" is behind all this. I have also tried flushing the stream but that didn't help either.
No it was a logical error. I was using the same XMLHttpRequest() object to make multiple calls. So while the former AJAX waited for a response(on event onreadystatechange), the latter call made a new object and used it. Hence, I'd get the last completed response(ResponseText) on any former calls.
Got it yesterday.
I'm sorry for not removing the post.
Thank you for your time.
Its the question that drives us.
WHAT is your favorite color? Blue, no yellow, ahhhhhhh! Tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop