Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Redirect Page while loading...

Status
Not open for further replies.
Mar 14, 2002
711
US
I am trying to figure out a way to redirect my users to a "waiting" page while a report is loading in the background so that the user does not continously click the Submit button after the data has been submitted and the page is processing.

This is used mainly on reservation pages such as Expedia.com and other travel pages where it searches the database. What I have is a simple html search page which submits some search criteria to a database and then the results are displayed in a table (ASP page).

I am not looking for the final solution, just some ideas where I can find more info and further develop the idea :)

Thanks in advance,
 
[tt]What I've done in the past is redirect the user to a blank page (you can pretty up the page the way you want to} wich contains the script below wich redirect the user back to the results page in a pre-set amount of time. The script is set to 15 seconds but you can modify it

***********************************************

<HEAD>

<SCRIPT LANGUAGE=&quot;JavaScript&quot;>

redirTime = &quot;15000&quot;;
redirURL = &quot;your_page.asp&quot;;
function redirTimer() { self.setTimeout(&quot;self.location.href = redirURL;&quot;,redirTime); }
</script>


<!-- STEP TWO: Insert the onLoad event handler into your BODY tag -->

<BODY onLoad=&quot;redirTimer()&quot;>

***********************************************


You can even place a &quot;Progress Bar&quot; icon on this page for the effect.














[tt]

buffalo.gif height="60px" width="30px"

 
Are you passing any variables across the pages when you do this? I am passing some variables from page 1 (html page) to the display page (asp page), but now when I put in the redirect page in between, the variables are of course not passed over to the final page it redirects to. I tried recalling the variables on the final page, but since session variables only last across one page, it fails. I was not sure if you had encountered this or not?

Thanks again for the redirect page, it does work well!
 
I do this:


Code:
<%
Response.Buffer = True
%>
<HTML>
<HEAD>
</HEAD>
<SCRIPT LANGUAGE=&quot;JavaScript&quot;>
if(document.layers) {
	var ns4 = true;
	}
if(document.all) {
	var ie4 = true;
	}

function showObject(obj) {
	if (ns4) obj.visibility = &quot;show&quot;;
	else if (ie4) obj.visibility = &quot;visible&quot;;
	}
function hideObject(obj) {
	if (ns4) {
		obj.visibility = &quot;hide&quot;;
		}
	if (ie4) {
		obj.visibility = &quot;hidden&quot;;
		}
	}

</SCRIPT>
<BODY BGCOLOR=&quot;#FFFFFF&quot;>
<DIV ID=&quot;splashScreen&quot; STYLE=&quot;position:absolute;z-index:5;top:30%;left:35%;&quot;>
<TABLE BGCOLOR=&quot;#000000&quot; BORDER=1 BORDERCOLOR=&quot;#000000&quot; CELLPADDING=0 CELLSPACING=0 HEIGHT=200 WIDTH=300>
<TR>
<TD WIDTH=&quot;100%&quot; HEIGHT=&quot;100%&quot; BGCOLOR=&quot;#CCCCCC&quot; ALIGN=&quot;CENTER&quot; VALIGN=&quot;MIDDLE&quot;>
<BR><BR>&nbsp; &nbsp; 
<FONT FACE=&quot;Helvetica,Verdana,Arial&quot; SIZE=3 COLOR=&quot;#000066&quot;><B>Working....  Please wait...</B></FONT> 
&nbsp; &nbsp; <BR> 
<IMG SRC=&quot;../images/splash.gif&quot; BORDER=1 WIDTH=75 HEIGHT=15><BR><BR> 
</TD>
</TR>
</TABLE>
</DIV>
<%Response.Flush%>




<% 
dim conn
set conn = server.CreateObject(&quot;ADODB.Connection&quot;)
Conn.open application(&quot;ConnectionString&quot;)
' Start stored procedure
conn.Execute(&quot;Reorganisatie&quot;)
conn.Close
%>

<%Response.Flush%>
<SCRIPT LANGUAGE=&quot;JavaScript&quot;>
if(ns4) {
	var splash = document.splashScreen;
	}
else if(ie4) {
	var splash = document.all.splashScreen.style;
	}
hideObject(splash);
</SCRIPT>
</BODY>
</HTML>


(splash.gif is an animated gif)


hth,
Foxbox
ttmug.gif
 
An ignorant question - the above code, do you post it on a separate page (page 2) and then redirect to the actual ASP page that displays the data, or do you run this on the same page where the ASP data table code resides?
 
no: this page put a window on screen with
Working.... Please wait...

and starts a stored procedure (&quot;Reoganisatie&quot;) (but you can do whatever heavy job there. After that finishing the job, the window is removed.
Yout may add the layout for the page that is suppose to show after finishing (put it after the conn.close). Eg

<h1>End of job</h1><br>
<a href=&quot;menu.asp&quot;>return to menu</a>





hth,
Foxbox
ttmug.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top