How to show a (wait) Animation until the MySQL results are back fully?


How does one show a wait animation in Php while the MySQL select results are being compiled?

To be exact say you go to a Php page which page is complete when 100 select results come back
from the MySQL DB. And it takes, depending on the traffic on the MySQL DB, from 5 to 30 seconds
before all the results come back. During this 5 to 30 seconds wait time rather than having the user
look at a browser page slowly (incompletely) loading we would like to show them a nice (wait centric)
animation. How is this done in Php?


You wouldn’t do this in PHP - PHP is just used for server side code. You likely want to achieve this by firing off an AJAX request, which will update the current page when it finishes.

Take a look at for some ideas.


Do you have a Javascrip, aka AJAX, related code for getting this done that you can recommend.
For various reasons I rather work with pure Javascript than JQuery.