determine if user aborted ajax request

D

Darko

Hi,

I am making an application that makes ajax requests to server, several
of them simultaneously. Now, several problems may occur:
1. Server aborted the connection (e.g. the server program terminated
unexpectedly)
2. User aborted the connection (e.g. pressed "Esc" key)
3. Server wasn't available at the time of request

Now, I want to distinguish these. I can ask for 'status' attribute of
the ajax request object, but it doesn't behave as expected:
1. If the server daemon it was connected to suddenly dies, the ajax
request object's 'status' attribute returns 200 as if everything was
fine, which I don't like.
2. If the client aborts, then asking for the 'status' attribute throws
an exception, and I can't even get the value. Which is worst, FF seems
to throw the exception in other situations, too, when I ask for the
'status' attribute.
3. If the server wasn't available, then requesting the 'status' throws
an exception again.

Now I now it's actually normal that the object doesn't have the
'status' attribute if it didn't get it from the server in form of '200
OK' (situation 2 and 3) etc. but how can I tell which of these two
things happened. And, also, how come it gets status 200 if the server
died and it didn't get anything from it?
 

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,770
Messages
2,569,584
Members
45,077
Latest member
SangMoor21

Latest Threads

Top