| Author |
Ajax request within some time should return response
|
sridhar lakka
Ranch Hand
Joined: Jan 02, 2007
Posts: 109
|
|
Hi All, Thanks a lot in advance. In our application we are using struts and ajax. I have a jsp page from which i am passing one ajax request to get some data.In some special case like network failure or system hang after passing this ajax request if this kind of problem occured then user may not know what is happened.To prevent this kind of misunderstanding. After passing ajax request if response is not returned within some time frame say after ten minutes an alert should some saying there is some problem. Please guide me how to do thi, if possible with some example code. Regards, Sree
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56179
|
|
|
Investigate the use of window.setTimeout() and the abort() method of XMLHttpRequest.
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
Alexei White
author
Greenhorn
Joined: Jul 20, 2007
Posts: 14
|
|
I think Bear is on the right track. I would use a couple things. I'd definately keep my finder on the 'abort()' method incase its taking TOO long, and I would also use a window.setTimeout() to trigger this action.. I would also want to alert the user that the request is going to take a while and use either an activity indicator, a progress bar, or both. You can also use a progress bar to track the progress of a server-side activity. Chapter 9 gives a detailed example of this. By the way, here are some great activity indicators: Activity Indicators [ July 26, 2007: Message edited by: Alexei White ]
|
Alexei White<br />Nitobi Software<br />-------------------<br /><a href="http://www.nitobi.com" target="_blank" rel="nofollow">www.nitobi.com</a><br />Enterprise Ajax Book <a href="http://www.enterpriseajax.com" target="_blank" rel="nofollow">http://www.enterpriseajax.com</a><br />f. 604.985.9287
|
 |
 |
I agree. Here's the link: jrebel
|
|
subject: Ajax request within some time should return response
|
|
|