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

141
Views
Recuperar la variable ajax del complemento JQuery AjaxForm

Aquí mi código:

 let xhr; function uploadFile() { const bar = $("#progressUpload"); const dialog = $("#modalUpload"); const alertOk = $("#alertUploadOk"); const btnClose = $("#btnClose"); const btnAbort = $("#btnAbort"); dialog.modal("show"); btnClose.prop("disabled", true); btnAbort.prop("disabled", false); xhr = $("#formUploadConfig").ajaxForm({ // <--- does not store the Ajax call beforeSubmit: function() { let percentVal = '0%'; bar.width(percentVal) bar.html(percentVal).attr('aria-valuenow', percentVal); }, uploadProgress: function(event, position, total, percentComplete) { let percentVal = percentComplete + '%'; bar.width(percentVal) bar.html(percentVal).attr('aria-valuenow', percentVal); }, success: function(response) { let percentVal = '100%'; bar.width(percentVal) bar.html(percentVal).attr('aria-valuenow', percentVal); alertOk.show(); }, complete: function(xhr) { if (xhr.responseText) { btnClose.prop("disabled", false); btnAbort.prop("disabled", true); } }, abort: function () { alert("aborted"); } }); }

Mi objetivo es almacenar la llamada Ajax para llamar a xhr.abort(); según sea necesario. Si estaba usando la función ajax estándar, era simple:

 var xhr = $.ajax({ ...

pero ahora estoy tratando de usar el complemento JQuery AjaxForm y no entiendo cómo recuperar esta variable.

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!