Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 306
  • Last Modified:

displaying waiting page

I have a webpage that get the data from database and it takes quite awhile to do this and i want to display it as soon as it done...
the problem is before i display the data I want the user to see the another page with a .gif animation on it and it said "please wait, processing your order."
how do I do this ? i did java script "onLoad" and redirected to the result on the waiting page but the gif image doesn't animate.

here is the waiting page

     <html>
     <script type="text/javascript">
         
          function loadit(){
               window.location = 'result.asp?sOrder=10';
          }
     </script>
     <title>processing order</title>
     <body onLoad="loadit()">
          <h1 class="PageHeads">processing <img src="../progress_ani.gif" border="0"></h1>
     </body>
     </html>    

0
spop12
Asked:
spop12
1 Solution
 
chriscaputoCommented:
Your onLoad is being executed right away.  You actually want to do something like this:

<script>
// this will set the reload timer
window.setTimeout("document.location=result.asp?sOrder=10");

</script>

<body>
working blah blah blah
</body>

The problem with this is it is not preloading the second page while the timeout happens - which I think is what you believe is happening.  In fact, the query won't get run till results get run (unless somehow your pre-running it and maybe moving the results into a smaller table that you pull on results.asp)

The way I'd do this?  I'd have the page display the animated gif in a layer... flush that to the browser (response.flush), then have it run the query... push results to a hidden layer.. when that is all done hide the processing layer and show the hidden layer..  

If this solution is something you'd be interested in doing, let me know and I'll give more details.

Good luck,
Chris Caputo
0
 
hansamryanCommented:
I would have to agree with Chris on this one.
0
 
spauljosephCommented:
Use this

'Main File
<Form Action="Progress.Asp" Method="POST">
Name : <Input Type=Text Name="txtName"><Br><Br>
<Input Type=Submit>
</Form>

'Progress.Asp
<%
  Session("txtName")=Request.Form("txtName")
%>
<Body OnLoad="Javascript:document.location='Query.Asp';">
<Img Src="yourgif.gif">

'Query.Asp
<%
  Dim con,rst
  Set con=Server.createObject("ADODB.Connection")
  Set rst=Server.CreateObject("ADODB.REcordSet")

  con.OPen  'Place open code here
  rst.Open "Select * from Table Where Name='" & Session("txtName") & "'"

  'Do the rest here
%>
0

Featured Post

[Webinar] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now