Upload page before call

Asked

Viewed 38 times

2

In my following example, I have a button that calls through the window.Place a page that takes some time to load. I am trying to create a javascript code that will load the page before it is called and a "loading" label will appear on the button page and then redirect to the other page

<label id="lbl"></label>
<input type="button" value="demo" id="btn_demo">

<script>
 var btn = document.getElementById("btn_demo");

 btn.onclick = function() {myFunction()};

 function myFunction() {

     document.getElementById("lbl").innerHTML = "LOADING!";

     if page == "loaded" {
        window.location.href="demo_load.htm";
     }  
    //call page
 }

  • See if it can help you http://stackoverflow.com/a/25253988

1 answer

0

Would that be?

<script>
    var goTo = function(){
        document.getElementById("lbl").innerHTML = "LOADING!";
        window.location.href="demo_load.php";
    }
</script>

<label id="lbl"></label>
<input type="button" value="demo" id="btn_demo" onclick="goTo()">

demo_load.php:

<?php
//Apenas para simular um processamento
sleep(5);

echo 'vim';

Browser other questions tagged

You are not signed in. Login or sign up in order to post.