PHP/ Javascript? Or both?

A

Anonymous

Guest
Hi all!
I have a php page which contains a form. The user enters data and then the data is processed to give some results. What I would like to have is a page inbetween, that says, for instance, "Your job is being processed" or something similar, and then, when the job is done, refresh itself to show the results. I have seen it in many websites, but I don't know what I need to get me started...
 
I have done this in the past without AJAX, and just PHP/Javascript.

Before PHP does any heavy processing, output some basic HTML that places a DIV on the page with the text "Your job is being processed". Next start a new DIV which is hidden (eg. <div style="display:none">). Do the processing that you need to do in PHP, perhaps build some output already (which will be hidden). After all the processing is done, close the DIV and output some JavaScript to show the content DIV and hide the loading DIV.

Coditor
 
Hi, thank you all for your time!
Actually, what I do is not just take user's input and print it, but i use the data which the user sends as input to an external program that I call through PHP. This program is a bit slow, so I thought of using such a page (not a very complicated one) so that the user will see a message like "Jour job is being processed", and then, when the job is done, the page will refresh and show the results or will redirect to the results page.
I will check on what you suggested... Should you think of anything else, pls write it down! Thank you very much!
 
Back
Top