When the user clicks a button on my JSP page this launches a struts action that will take between 30 and 40 mins to complete as it iterates through a list with 1000s of items. What is the best way to keep the user informed of the progress?
Should I have a
setTimeout( updateUI(), 30000);
type call that will recursively call itself every 30 secs and ping the server for a progress status.
Is there any JQuery utility that might make this easier?
There are other web technologies that don’t work in all browsers and require more effort to setup such as web-sockets. However, the simple solution is to use
setTimeoutWhen you first initiate your request, the success callback will setTimeout for the same request again after XX seconds. If the server is slow to respond, you will only ever make a request 30 seconds after you’ve received a successful response. Avoiding stacking queries and additional load.
To my knowledge, there isn’t a jquery ajax property you can set to handle this as there is with other libraries such as prototypejs.