[jQuery] Ajax Requests Throw Error If User Clicks a Link on a Page While the Request Is Still Active
OK, we have our intranet pages setup so that when viewing customer
records, the page is set so that it refreshes various important divs
when the window is brought to the front by the user.
Our system has been working great for years now, but in trying to use
newer browsers we now have big problems.
The problem now with new browsers is that if the users clicks on a
link while a XMLHttpRequest request is currently active, an error is
thrown by the ajax handler
Here's a sample to demo the issue: http://homepage.mac.com/zacware/xhr_bug/xhr_bug.htm
We deployed our intranet using FireFox 1 and FireFox 2 years ago.
These never caused the issue, and everything worked great. But now in
trying to use FireFox 3 and Safari 4, we are getting error messages
all over the place.
When this happens, we get a readystate of 4 and a status of 0. I would
like to think there would be an "abort" error code like when you get a
404 for a file not found.
Does anyone have any thoughts on how I can know definitively that an
error is due to an aborted request versus a more serious error?
I was going to have the error handler ignore errors with a readystate
of 4 and a status of 0, but doing that makes my somewhat
uncomfortable. My original understanding was that a readystate of 4
and a status of 0 was not a defined combination.