DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2009
    Posts
    3

    "please wait" page

    Okay, I've looked at a few tutorials, yet I can't seem to get this right. I have some experience with other programming languages, but little with Javascript.

    I currently have a PHP page that takes a little while to load, and I want to have it display a "please wait" page while it processes. Basically, I want the flow to be as follows:

    User input page -> intermediate "please wait" page -> PHP results page

    However, I can't seem to get it to work. My main problem is that I don't know how to pass the posted variables through the intermediate page. I tried making the "please wait" page PHP and assigned the post variables to session variables, but the final page didn't seem to recognize them. Thoughts?

  2. #2
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,649
    Welcome to DevX
    Quote Originally Posted by djslothario View Post
    Okay, I've looked at a few tutorials, yet I can't seem to get this right.
    What have you tried that doesn't seem to be working?
    I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
    Please use [Code]your code goes in here[/Code] tags when posting code.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    Modifications Required For VB6 Apps To Work On Vista

  3. #3
    Join Date
    Mar 2009
    Posts
    3
    Okay, I decided to change it a little.

    so the structure, for reference, is indexTst.html -> one of those floating boxes made with CSS -> processTst2.php

    IndexTst.html code:
    HTML Code:
    <form action="processTst2.php" method="POST" name="queryform">
    stuff
    <input type="submit" onClick="getContent()">
    </form>
    
    <div id="wait" style="background-color:white;position:absolute;top:240px;left:360px;width:70px;height:50px;visibility:hidden;border: 1px solid black;padding:20px;">
    	<img src="images/wait.gif" style="position:relative;top:0px;left:25px"><br /><br />Please wait...</div>
    Here's my javascript code:
    Code:
    var request;
    
    function getHTTPObject() 
    {
        var xhr = false;
        if (window.XMLHttpRequest) 
        {
            xhr = new XMLHttpRequest();
        } else if (window.ActiveXObject) {
            try 
            {
                xhr = new ActiveXObject("Msxml2.XMLHTTP");
            } 
            catch(e) 
            {
                try 
                {
                    xhr = new ActiveXObject("Microsoft.XMLHTTP");
                } 
                catch(e) 
                {
                    xhr = false;
                }
            }
        }
        return xhr;
    }
    
    function getContent()
    {
        request = getHTTPObject();
        request.onreadystatechange = sendData;
        request.open("POST", "processTst2.php", true);
        request.send(null);
    }
    
    function sendData()
    {
    	if (http.readyState == 4) {
    		document.getElementById('wait').style.visibility = "hidden";
    		alert('The server script has now completed');
    		window.location = "processTst2.php";
    	} else {
    		document.getElementById('wait').style.visibility = "visible";
     }
    }
    The odd thing is that it does redirect and process2.php works fine. Thoughts?
    Last edited by djslothario; 03-20-2009 at 01:39 PM.

Similar Threads

  1. Reload already opened asp page!
    By vermankita in forum Web
    Replies: 0
    Last Post: 02-13-2009, 11:52 PM
  2. Change page title on AJAX site...JS?
    By raindance in forum AJAX
    Replies: 11
    Last Post: 12-17-2008, 06:27 PM
  3. Replies: 0
    Last Post: 08-30-2007, 03:51 PM
  4. Loading Page Variables
    By hoyaabanks in forum ASP.NET
    Replies: 0
    Last Post: 02-26-2007, 03:46 PM
  5. Replies: 4
    Last Post: 06-24-2005, 01:40 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links