Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

182
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda