Re: howto: please wait, this may take a few seconds...



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.

.



Relevant Pages

  • Re: howto: please wait, this may take a few seconds...
    ... > You could also do it without Javascript. ... > // time consuming task ... > display: none; ... You want a flush() after your div so it becomes visible. ...
    (comp.lang.php)
  • Re: Mouse position not working anymore
    ... I need to get the mouse cursor's position using JavaScript. ... of JavaScript code isn't working anymore. ... Go back to a version of your script file that works and apply your new ... error using *only* the positioning function. ...
    (comp.lang.javascript)
  • Re: Obtaining query_string from JavaScript
    ... rid of the security-relevant `.php' in the URI): ... I suppose content negotiation could also be used to ... to write expressions for each script file (and have PHP parse all, ... Prototype.js was written by people who don't know javascript for people ...
    (comp.lang.javascript)
  • Re: Adaptive forms with Javascript
    ... Damo said: ... I'm new to javascript and i'm trying to create a simple form that: ... Check the name of your script file. ...
    (comp.lang.javascript)
  • Re: Adaptive forms with Javascript
    ... I'm new to javascript and i'm trying to create a simple form that: ... Check the name of your script file. ... oops... ...
    (comp.lang.javascript)