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

203
Views
Llamar jQuery Ajax Solicitar cada X minutos

¿Cómo puedo llamar a una solicitud de Ajax en un período de tiempo específico? ¿Debo usar Timer Plugin o jQuery tiene un complemento para esto?

over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

Puede usar el javascript setInterval incorporado.

 var ajax_call = function() { //your jQuery ajax code }; var interval = 1000 * 60 * X; // where X is your every X minutes setInterval(ajax_call, interval);

o si eres del tipo más escueto...

 setInterval(function() { //your jQuery ajax code }, 1000 * 60 * X); // where X is your every X minutes
over 4 years ago · Santiago Trujillo Report

0

Un poco tarde pero usé el método jQuery ajax. Pero no quería enviar una solicitud cada segundo si no recibía la respuesta de la última solicitud, así que hice esto.

 function request(){ if(response == true){ // This makes it unable to send a new request // unless you get response from last request response = false; var req = $.ajax({ type:"post", url:"request-handler.php", data:{data:"Hello World"} }); req.done(function(){ console.log("Request successful!"); // This makes it able to send new request on the next interval response = true; }); } setTimeout(request(),1000); } request();
over 4 years ago · Santiago Trujillo Report

0

puedes usar setInterval() en javascript

 <script> //Call the yourAjaxCall() function every 1000 millisecond setInterval("yourAjaxCall()",1000); function yourAjaxCall(){...} </script>
over 4 years ago · Santiago Trujillo 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!