There is no truly good way to solve this problem with HTTP/HTML. That's because these technologies were never
meant to solve that problem. HTTP is a stateless protocol, so it only lives by responding to user requests. It can't just send a "request" of it's own to the browser whenever it wants.
There are 3 possible workarounds, at varying levels of complexity:
1. The simplest approach might be to just take Quasibobo's suggestion, but set the refresh at 1 second. Then the page keeps on refreshing, and whenever the results are available, they load instead of the refreshing page. I know you want better than 1 second resolution, but really, just about any web page takes at least a second to load, so it's not such a bad way to go.
2. With a hidden frame, you can hide the page that actually does the refreshing. Just use a bit of javascript in the hidden refreshing page to trigger a load of the main page when the results are ready.
3. Certain webservers (and most recent browsers) allow for partial loading of HTML, while keeping the HTTP connection open and idling until the rest of the data appears. With this in mind, you would use PHP's flush() function (
to output the "wait" message to the browser right away, and then keep the HTTP connection open until the rest of the data is received and printed. Bear in mind that PHP defaults to a maximum execution time of 30 seconds per script, unless you change the php.ini settings, or make a run-time configuration change for that script. -------------------------------------------
Big Brother: "War is Peace" -- Big Business: "Suspicion is Trust"
(