10 second timer

How to run PHP script in every 10 seconds? – Using Jquery and ajax allows for calling an XHR request every set amount of milliseconds (setInterval). In this case, it is 10000 milliseconds for 10 seconds. The script below stored at (run. html) when called will continuously run a get request to call.

 

You can put a task (such as command or script) in a background by appending a & at the end of the command line. The & operator puts command in the background and free up your terminal. The command which runs in background is called a job. You can type other command while background command is running.

 

10 second after script run in php ?

 


<html>
    <script src="//cdnjs.cloudflare.com/ajax/libs/visibility.js/0.5/visibility.min.js"></script>
    <script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js" type="text/javascript"></script>
<script>
var seconds=20;
var flag=false;


$(document).ready(function(){
if (!flag)
Visibility.every(1000, tick);



function tick()
{
      display();

        if (seconds>0)
        {
         seconds--;
        }
        else
        {
          if (!flag){
          document.getElementById('more').innerHTML +="<?php include_once('Code.php'); 
          ?>";
          document.getElementById('more').style.visibility='visible';
          flag=true;
          }
        }
}
function display()
{
   $("#timer").html(seconds);
}
});
</script>
<div id="TrafficHeader" style="height:100px; background-color:grey; padding:20px;">
<div id="timer"></div>
<div id="more" style="visibility: hidden;"><a href="http://www.double-it.com/Traffic/index.php">View Next Ad</a></div></div>
<iframe id="myframe" src="<?php echo ''.$URL;?>" height="100%" width="100%" frameborder="0">
</iframe>
</body>
</html>

Leave a Reply

Your email address will not be published. Required fields are marked *