4
I would like to know the maximum range that can be used in the method setInterval javascript.
I ask this, because I used setInterval the way below and it did not execute. I don’t know if it’s something in the code or some time limit that setInterval has.
//Aqui repitimos a função de cima a cada 60 segundos 
let logar_usuario = setInterval(logarUsuario, 60000);
function logarUsuario() {
  $.ajax({
    type: "POST",
    url: "../banco/atualizar-log-usuario/deixar-usuario-logado.php",
    cache: false
  }).done(function() {
  }).fail(function() {
  }).always(function(data) {
  });
}
- In this case, I would like to call the function every 60 seconds. I don’t know if setInterval() supports this full time interval.
 
At first there is no limit (at least I do not know). 60 seconds is very little, and certainly supports this value. If your code doesn’t work, the problem must be another.
– Sam
I also executed the snippet above and waited 60 seconds and came reply normally. As I said, the problem may be another. Decrease the time to 10 seconds and see if anything pops up on the console after 10 seconds.
– Sam