ckroon
Posts: 869
|
Posted: 02/23/2012, 2:29 PM |
|
Hi All.
I have some pages that execute SQL code when a user clicks a link.
Right now they just stare at an empty page while the DB does its thing.
For the few minutes they are waiting I would like to display something.
I have the sql code in the Initialize View event of the page.. and it redirects to another page of code when its done.
Any way to echo a message or display a gif while it is working?
Thanks!
_________________
Walter Kempees...you are dearly missed. |
|
|
clahti2
Posts: 107
|
Posted: 02/27/2012, 3:29 PM |
|
easiest way to do this is to have your "interim" page do an asynchronous ajax call to a "processing" page which does the db work, I cannot post the actual code example because CCS forum suppresses AJAX code (which it should). I have this exact situation where I actually call six pages in series, the "interim" page uses an AJAX progress bar to show the steps. You could use output from a single "process" page to drive the progress bar as well. Have a look at:
http://www.bram.us/projects/js_bramus/jsprogressbarhandler/
for the progress bar, then use Prototype function Ajax.Updater() to make the call. There is actually an example in the source for this progress bar on the Prototype function. You listen for info coming from the process page to both update the progress and update a DIV control, once you capture the javascript onComplete function you then use window.location to then redirect to your "thanks for waiting" page .
Doing a single AJAX Ajax.Updater() call is a piece of cake, doing six in series to a while to figure out, but works well in any case.
/Chris
|
|
|
clahti2
Posts: 107
|
Posted: 02/27/2012, 3:46 PM |
|
something possibly slightly less complicated would be to put an animated GIF file on the "interim" page while the Ajax.Updater() or Ajax.Request() does the work, have a look at Prototype docs:
http://api.prototypejs.org/ajax/Ajax/Request/
If you want the process initiated by a button click you could put the GIF in a panel that is hidden, and set the Visible property to true and fire the AJAX call in the onclick button event.
|
|
|
ckroon
Posts: 869
|
Posted: 02/29/2012, 9:19 AM |
|
Thanks!
_________________
Walter Kempees...you are dearly missed. |
|
|
|