• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Ajax request within some time should return response

 
sridhar lakka
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64717
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Investigate the use of window.setTimeout() and the abort() method of XMLHttpRequest.
 
Alexei White
author
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic