User not logged in - login - register
Home Calendar Books School Tool Photo Gallery Message Boards Users Statistics Advertise Site Info
go to bottom | |
 Message Boards » » AJAX response question Page [1]  
RSXTypeS
Suspended
12280 Posts
user info
edit post

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

dakota_man
All American
26584 Posts
user info
edit post

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

Noen
All American
31346 Posts
user info
edit post

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

RSXTypeS
Suspended
12280 Posts
user info
edit post

^^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

RSXTypeS
Suspended
12280 Posts
user info
edit post

hmm.... using try/catch doesn't prevent FF3 from directing to its can't establish connection page....

1/29/2009 6:11:41 PM

Noen
All American
31346 Posts
user info
edit post

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

RSXTypeS
Suspended
12280 Posts
user info
edit post

just got it working...yeah i had to use an XML request. Works great! thx.

1/29/2009 6:40:33 PM

 Message Boards » Tech Talk » AJAX response question Page [1]  
go to top | |
Admin Options : move topic | lock topic

© 2024 by The Wolf Web - All Rights Reserved.
The material located at this site is not endorsed, sponsored or provided by or on behalf of North Carolina State University.
Powered by CrazyWeb v2.39 - our disclaimer.