• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

progress bar

 
krishna prasad gunasekaran
Ranch Hand
Posts: 158
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
good day,
i am saving my data through ajax. i save data in 5 different tables. it takes at least a minimum of 20 seconds for the save to complete. i need a progress bar to keep users informed about the save status, so that they may not be left irritated "what the hell is happening with this application?!..."

have a good day
krishna prasad
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A lot of people show a hidden div over the screen or beside the button with an annimated gif.

A site lets you design your own here: http://www.ajaxload.info/

Eric
 
krishna prasad gunasekaran
Ranch Hand
Posts: 158
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you eric,
but my question is, how am i to link the progress bar with server side saving process.
for example, if we are downloading a file, the progress bar increments itself as the download progresses. in the same way, how am i to increment my progress bar depending upon the saving process that is happening in server side?

good day eric,
krishna prasad g
 
Rax Malhotra
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Prasad,

You can write a .txt file like a simple html page having a table inside <div> tag



and import it in jsp page and call the function start & stop as per your requirement frm within the javascript method



 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The download progress bar works because the server tells the browser the file size first. As the browser receives bytes, it can compute the percent complete.

You can't really do that with a process running on the server. You'd have to make the server send percent done updates to the browser, possible but fairly high effort for something that runs a few seconds. Besides which it's hard to tell when a SQL update is 50% done.

If you sent 5 AJAX requests you could keep track of how many have completed, but in a single request I'd probably go with some animation on the browser. I've been around an animated GIF before, and a JavaScript routine that did a text animation. Either of those can run forever if the server hangs or your "stop animation" event fails, and they might tick the user off more than nothing.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic