When I click on a php button I want "please wait" message before the code starts

Hi,
I have a grid application and on the toolbar I have a php button. Under that button is about 1000 lines of code creating an xml file and posting it to the taxation authorities.

The problem I have is that when I click on the button, it can take a few (swell about 10) seconds to process. I tried to run a “spinner” in some html code at the very beginning of the code, but it is not executed until all of the code is processed. I just wanted to alert the user that it is working, and not frozen.

I have placed a number of echo statements in the code, but once again, they do not display until the last line has been processed.

Can this limitation be resolved? Can I alert the user that it is working, and they just have to wait?

Thanks
Tony

I have this in my hand dandy Snippets document. I pulled it off these forums some time ago and have used it successfully… though your mileage may vary.
/////
WAITING MESSAGE WHILE LOADING

I have a control application that takes in some information before I sc_redir(my_blank_application) to produce the PDFs (hand coded).
The blank application takes about thirty seconds to complete and I wanted some kind of indication
to the end user that the application hadn’t stopped working.

In the control application → Events → onApplicationInit I put (obviously doesn’t have to be as fancy as this)…

[head_loading]=’

.spinner { border: 2px solid #a1a1a1; padding: 10px 40px; background: #dddddd; width: 300; height: 120; margin-left: auto ; margin-right: auto ; border-radius: 25px; font: 15px arial, sans-serif; }
Running Processes. Please wait...  
';

In the control application → Events → onValidateSuccess I put…

echo [head_loading];
sc_redir(blank);///this goes to the page with teh Heavy Lifting… it wont load until its done and the spinner message will display in the meantime.

Now, immediately I click “Ok” in the control application, the spinner

displays and remains there until the blank application completes it’s job.

///
Good luck!