|
Posted by IWP506 on 10/07/26 11:27
Chung Leong wrote:
> There are a number of ways to do an asynchronous look up through
> Javascript. If you need something sophisticated, Google the web for
> AJAX libraries.
>
> A simple, cross-browser technique I've used before involves using
> setInterval() to periodically call a function, which then dynamically
> creates a <SCRIPT> tag linking in a PHP-generated script file. This
> script file would contain just a call to a function already defined,
> passing updated information from the server as parameter.
>
> You could also do it without Javascript. Just print out a message,
> perform the time-consuming task, then output a CSS style retroactively
> to turn off the message.
>
> Example:
>
> <div id="test">
> please wait, this may take a few seconds...
> </div>
> <?
>
> // time consuming task
>
> ?>
> <style>
>
> #test {
> display: none;
> }
>
> </style>
>
> The trick here is in keeping the browser from timing out and proper
> buffer flushing.
You want a flush() after your div so it becomes visible. Otherwise, it
defeats the purpose.
<div id="test">
please wait, this may take a few seconds...
</div>
<?
flush();
// time consuming task
?>
<style>
#test {
display: none;
}
</style>
Navigation:
[Reply to this message]
|