I have an application that has an interval updater. I basically need a way that when a request is sent out to the server and the server is down...I can display a message to say so in the app without having the browser redirect to the 'server is down' default page.I know with onFailure: function(t) i can check the status of the response (2xx, 4xx, 5xx, etc) but how would I go about checking for no response at all?
1/29/2009 5:16:44 PM
I know 0 about web development, but how slow would it be to check the server somehow before sending each request?
1/29/2009 5:26:44 PM
sounds like you need try/catch/finally runtime error handling for your function calls. If it fails, it will error out and you can catch the failure with an appropriate response.http://www.w3schools.com/js/js_try_catch.asp
1/29/2009 6:02:38 PM
^^That's what I'm actually trying to do. Its just a blank AJAX request to see if the server is there or not before I preform a full page reload or display a "service temporarily unavailable" message.(the full page reload is not my idea, I wanted to do AJAX but was vetoed due to users book marking)^thanks, i was just looking at that. [Edited on January 29, 2009 at 6:04 PM. Reason : .]
1/29/2009 6:03:31 PM
hmm.... using try/catch doesn't prevent FF3 from directing to its can't establish connection page....
1/29/2009 6:11:41 PM
yeah you'll need to make sure the request is fully encapsulated in a xmlhttp request (or whatever the hell that method call is) and not using any real forwarding/redirection
1/29/2009 6:25:51 PM
just got it working...yeah i had to use an XML request. Works great! thx.
1/29/2009 6:40:33 PM