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

71
Views
Solicitud de llamada Ajax cada 5 segundos y esperar antes de enviar la solicitud hasta que se envíe la solicitud anterior

Quiero enviar una solicitud ajax cada 5 segundos y cada solicitud espera hasta que la solicitud anterior se envíe con éxito. Este es mi código, funciona pero envía solicitudes incluso si la solicitud anterior no se envió correctamente.

Aquí mi código:

 $(document).ready(function() { $('#myform').on('submit', function(e) { e.preventDefault(); $("#sending").show(); $("#send").attr('disabled', true); $("#send").attr('value', "Sending ..."); var ajax_call = function() { $.ajax({ url: "fbshr.php", type: "POST", data: { postURL: $('#postURL').val() }, success: function(data) { $(data).appendTo($("#response")).before(""); $('#response').animate({ scrollTop: $('#response').prop("scrollHeight") }, 500); $("#num-msg-1").html($('#response p.alert-success').length); $("#num-msg-2").html($('#response p.alert-danger').length); } }); }; var interval = 5000; setInterval(ajax_call, interval); }); });
about 4 years ago · Juan Pablo Isaza
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!