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

103
Vistas
Ajax is not aborting when stop button is clicked

I have this code, and when the stop button is clicked, I need to stop the ajax, but for some reason ajax is not aborting.

var started = false;
  $(document).ready(function () {
  $('#start').click(function () {
  var count = $("#names").val();
  var line = count.split("\n");
  started = true;
  line.forEach(function(value, index) {
      setTimeout(
              var ajaxCall = $.ajax({
                  url: url,
                  type: 'GET',
                  data: someData,
                  success: function(result) {
                      //some works here
                   }
              });
                      $('#stop').click(function () {
                      ajaxCall.abort();   //abort Ajax
                      $('#check').attr('disabled', false);
                      $('#stop').attr('disabled', 'disabled');

                  })
          }, 2000 * index);
       });
  });

});

about 4 years ago · Santiago Gelvez
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