MikoLone
03-26-2008, 07:43 PM
How can you check with ajax if the server is down. I hacked my way into a solution but I imagine there is a better way. This is how I did it. The snippet is inside the onreadystatechange event.
try{
var blah = GlobalRequester.status;
}catch (e){
alert('servers down');
GlobalRequester = null;
return;
}
I noticed that when the server is down the httprequester.status throws an error so I catch and then alert server error. This works but I imagine there are other times when the status will throw an error like this and I am just wondering if there is another way to know that the server is down.
Thanks
Michael
try{
var blah = GlobalRequester.status;
}catch (e){
alert('servers down');
GlobalRequester = null;
return;
}
I noticed that when the server is down the httprequester.status throws an error so I catch and then alert server error. This works but I imagine there are other times when the status will throw an error like this and I am just wondering if there is another way to know that the server is down.
Thanks
Michael