Jump to content

redirecting user whilst processing information


daydreamer

Recommended Posts

On a site I am making a user inputs details, submits them and then I do some processing via php.

 

Problem is processing takes about 5-10 seconds. this is a long time for a user to be waiting looking at the same page not being able to do anything.

 

So, can i redirect them to another useful page of my site, while i process the information they gave me on the server?

 

Link to comment
Share on other sites

Why go to all that trouble for 10 seconds? I'd just have a nice animated gif ...processing.... so they can see something's happening.

 

Only other thing I can think of is do what F1Fan said, use a bit of javascript to pop-up a nice overlaying div, keep 'em entertained.

 

Seriously though, are your visitors that edgy?

Link to comment
Share on other sites

Here's some code that I use throughout my sites:

 

<script type="text/javascript">
function pleaseWait(){
  document.getElementById('pleasewait').style.display = "none";
}
</script>
<body onload="pleaseWait();">
<table width="100%" height="100%" bgcolor="#FFFFFF" id="pleasewait" style="display:block;z-index:2;position:absolute;left:0px;top:52px;">
<tr height="225">
	<td width="100%" colspan="3">
		 
	</td>
</tr>
<tr>
	<td width="49%">
		 
	</td>
	<td align="center" valign="middle" width="2%" nowrap>
		Please wait...<br>
		<image src="images/pleasewait.gif">
	</td>
	<td width="49%">
		 
	</td>
</tr>
</table>
<!-- rest of your body here -->

 

This code can be easily modified to work on unload. Just replace "onload" with "onunload,"

document.getElementById('pleasewait').style.display = "none";

with

document.getElementById('pleasewait').style.display = "block";

and

<table width="100%" height="100%" bgcolor="#FFFFFF" id="pleasewait" style="display:block;z-index:2;position:absolute;left:0px;top:52px;">

with

<table width="100%" height="100%" bgcolor="#FFFFFF" id="pleasewait" style="display:none;z-index:2;position:absolute;left:0px;top:52px;">

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.