File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes HTML, CSS and JavaScript and the fly likes AJAX Issue - Messages got lost... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "AJAX Issue - Messages got lost..." Watch "AJAX Issue - Messages got lost..." New topic

AJAX Issue - Messages got lost...

Ram Kumar
Ranch Hand

Joined: Jun 19, 2006
Posts: 39
I am having this issue when calling two AJAX calls from my code.

One is time to run every 3 seconds using windows.setInterval (for 10 seconds) and I call a method which calls a jsp page.

I have another ajax call that calls another servlet which is called manually by user input using onClick.

The first one calls a jsp to fetch a html response which it uses to build the client html (div.innerHTMl += response from ajax call) this is a for a import operation.

The second call (through onclick) basically calls the servlet to cancel the import operation.

Whenever I call the 2nd one the first is also called. I see the time stamps of calls from the first call to java frome the first call consistently happening every 10 seconds. When I do the onclick and call another method in java script to do the 2nd ajax call the first one seems to be called as well. I checked whether I am calling the first method in the 2nd and I didn't.

I dont know what is causing this behaviour. Because, of that the messages to be obtained by the first call gets lost somehow).

I did create my xmlreq obj using new ActiveXObject("Microsoft.XMLHTTP"), is the xmlhttp req object commonly used by all AJAX calls?

Please let me know.

-- SCJP 5, OCPJBCD 5, OCPJWSD 5 (in progress)
Eric Pascarello

Joined: Nov 08, 2001
Posts: 15385
Sounds like you are using global variables. Without seeing how you are making requests, I can not give you an exact answer.

Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63866

Both Eric and I have said it again and again. You can save yourself a ton of headaches by letting a library such as jQuery or Prototype handle Ajax calls for you.

[Asking smart questions] [About Bear] [Books by Bear]
I agree. Here's the link:
subject: AJAX Issue - Messages got lost...
It's not a secret anymore!