Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

175
Views
how to load each php file for 5 mins then move to the next one?

I have 5 PHP files, (1.php,2.php,3.php,4.php,5.php) how can I load 1.php for 5 mins, then load 2.php for 5 mins then again 1.php after that 3.php in a specific order.

I have tried it with a button but I want it to do that without buttons just 5 mins then move on

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

a server just response to clients requests , as its name explaied , it will be serve your request and give it to you. so when you request 1.php and recieve it in client , for changing it you must create a new request and gets new server response, it can be done by javascript and specially by ajax request . although there is another way for achiving this requirement and it is : getting all 1-5 .php files in one request and shows them in sequesnce , obviously in this aproach you needs to js too but atleat you will decrease your requests to server and this is how SPA appliactions works (in an abstract description) so you must do something as blow :

function keepAlive() {
    doAjaxCall();
}
window.onload = function() {
    var interval = window.setInterval(function() { keepAlive(); }, 5 * 60 * 1000);   
}

and then define your ajax call :

function doAjaxCall(){
    $.ajax({
    type: "POST",
    url: "/route/to/nextFileHandler.php",
    data: "current=current_php_file_number",
    timeout: 5000,
    success: function(data) {
      $('body').html(data); 
    },
    error: function(XMLHttpRequest, textStatus, errorThrown) {
      console.log(textStatus);
    },
  }); 

  return false;
});

beside of "serInterval" sister function : "setTimeout" you can call another approaches to , using :

<meta http-equiv="Refresh" content="300"> 

metha data leads to refresh your page every 300 sec (5 min), then you can load your ajax call on load jquery events.

in any case , you must be friend with js !

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!