Refresh screwing up AJAX

N

nowhereface

The refresh button (or reload button, whatever you want to call it) is
screwing up AJAX. I have AJAX requests coming from the client, and
servlets that kick up on the server to handle them. It's a "delayed
update" situation where the server doesn't respond until it is ready
and has data, so there may be 30 seconds or a minute before the server
responds (the servlet sleeps during this time). If I hit refresh in
between the AJAX request and the AJAX response (I'm testing, and
trying out anything a user might try), it screws it up to where I do
not get an AJAX response. This also causes the client to not kick off
another AJAX request, because it must get a response before it can
fire off another AJAX request (the javascript to kick off another AJAX
request is actually contained in the AJAX response from the server).
In short, the application breaks.

I have tried many things to try to remedy the situation. On the
server end, I've tried to detect a reload, and have the new servlet
which just fired up to handle it kill the (old) sleeping servlet, and
"take its place" so to speak. I've tried having the new servlet which
fires up signal the old servlet to wake up and send its data. I've
tried having the new servlet simply not do anything but exit (leaving
the old servlet sleeping, hopefully to wake up and send the data when
complete). I've tried to not do anything and let the new servlet
process simultaneously with the old servlet (this seems bad to me,
because it seems I will have as many servlets and as many AJAX
requests pending as the number of times the user hits refresh, and
worse, it seems they will all try to cause the client to send another
AJAX request when they send their data). In short, I've tried
everything. I've rewritten the client side many times. I've
rewritten the server side many times. Nothing works. If the user
hits refresh, it screws up my AJAX. I tried to google "refresh/reload
screwing up AJAX" but didn't get anything useful for my particular
problem.

I am running an Apache server (have no idea whether this is relevant
or not).

I'm no web developer, and have limited experience with any of this
stuff. Any AJAX gurus who can tell me what's going on?

Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,979
Messages
2,570,185
Members
46,728
Latest member
FernMcmull

Latest Threads

Top