Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

183
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda