I need to display an html page and within the page is a div into which I want to echo the output of a PHP page.
While the PHP page is being fetched and prepared I want to display a “Loading” msg and a temporary gif.
I have the html code working
and I have the PHP code working/echo’ing.
How do I echo the contents of the PHP page to replace the original contents of the Div.?
(I guess – with an include:file and an innerhtml statement, but how/where?)
A Javascript solution would be fine.
Thanks
You’re essentially looking to make an asynchoronous call to your php script once the page is loading, so JavaScript is your friend.
When the page loads, include the loading message and the temporary gif, then do an ajax call to your php script and insert the response into the relevant div.
As @Sjoerd points out – jQuery will do this for you nicely.