My application is in PHP.
I have a payment form where shipping is being calculated through AJAX when the user clicks on "Calculate Shipping" Button. The trouble is sometimes there is a time delay before the Servers Send back the info to the Browser.
Meanwhile I'd like to display a "Processing.. Please wait" notification to the User.
How is this done ?
Is this done with Javascript? Are there any ready made scripts for this ?
The window should disappear once the user gets his shipping options.
You are going to use javascript to achieve this - but with libraries it shouldn't be too difficult. What library are you currently using (if any) to do the ajax calls?
From my research it appears like Yahoo's YUI library is one of the best. They have something called a 'Panel' which allows you to easily define options, of how it looks like. The panel has 'show' and 'hide' methods, so all you need to do is call the 'show' right before and ajax call, then the 'hide' once you get the response. Inside the panel, you can have text, html, images, whatever you want.
But Doesnt work properly for me. In IE, I have to scroll up to see the 'Please wait' window as my page is pretty long.
In Firefox, it doesnt even show up.
How do I make sure that the "Please wait..DIV" stays on Top of the Page and just about in the middle of my screen.. ?
Earlier my JS code was something like this..
// Set 'Please wait' window visibility to Visible
// Call HTML_AJAX() Function here.
// Set 'Please wait' window visibility to Hidden
Somehow, the window was opened and closed, though the PHP script that my HTML_AJAX() fucntion calls, had not brought down the results.
Now.. I changed my JS code to
// Set 'Please wait' window visibility to Visible
// Call HTML_AJAX() Function here.
In the end of my PHP SCript, which HTML_AJAX calls, I placed this JS CODE,
// Set 'Please wait' window visibility to Hidden
It works perfectly.. now.. The window pops up and stays till the script delivers the results and then vanishes.
Also, to Position the DIV correctly , I just placed the DIV code in the FORM where I wanted it and just increased the z-index number.
Bookmarks