HTML_Progress2 : The Definitive Guide |
Tracking the progress of a server-side operation by a client requires only one operation. A polling loop that will iterate one or more times until server task is completed (100%). This is done by JS function HTML_Progress2.statusCheck what will send periodically (update by interval; default is 2 seconds) a request to server either with :
HTML_Progress2.serverClassName, HTML_Progress2.serverMethodName
HTML_Progress2.serverCallback,
as callback.
When the user-task is over and server return progress bar reach 100% (key: percentage, value: 100), client run function identified by HTML_Progress2.onComplete (default behavior is to reload the same page with query string "reload=true").
If you want to change this behavior, you have just to change value of public HTML_Progress2.onComplete variable, and identify another function. See scriptaculous1 and scriptaculous2 examples.
Launching polling loop through asynchronous communication, is done by only one client action: run JS function HTML_Progress2.start with identifier of progress bar (given by HTML_Progress2::getIdent), and with an optional latency (in millisecond) between two request calls.
HTML_Progress2 : The Definitive Guide | v 2.4.0 : April 20, 2007 |