How do I distingish this from server down?

How do I distingish this from server down?

Hello,

In the middle of ajax request, if you navigate away to different page by clicking a link, it throws error...
When I looked at the status, that was 0....which is same status returned when the server down.
Actually, I compared two scenario, server down and page navigation away in the middle of ajax request...
I noticed that both scenario has returned same error information, which is status 0, and readyState 0...statusText is "error"..

I was googling to find out some information... I found a couple of workaround for this issue...
Someone says that getAllResponseHeaders can be used...however, unfortunately, this didn't work at all. Someone says could be flagging some status in beforeunload event handler..so it could check.blahblah.....Not sure whether this works or not..I haven't tried this..however, it sounds like not something I want to follow...

Anyone have better solution for this issue?

Thanks,