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

171
Views
Agregar carga a sweetalert cuando envíe una solicitud a livewire

Escribí mi código a continuación y funciona correctamente y la respuesta se recibe correctamente. Pero el problema es que cuando se hace clic en el botón de confirmación, la alerta dulce se cierra.

Quiero que la alerta dulce no se cierre hasta que la solicitud se ejecute por completo y se muestre el botón de carga. Vi muchas preguntas sobre esto, pero estaban relacionadas con ajax y no pude crearlas para livewire.

 document.addEventListener('DOMContentLoaded', function () { $('.eg-swal-av3').on("click", function (e) { Swal.fire({ title: 'title', text: "content", icon: 'info', showCancelButton: true, confirmButtonText: 'بله ایجاد کن', cancelButtonText : 'لغو', }).then(function (result) { if (result.value) { @this.call('createRequest'); } }); e.preventDefault(); }); });
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Está buscando la propiedad preConfirm , que acepta una devolución de llamada. Aquí es donde ejecutaría la llamada a su createRequest .

También agregaría allowOutsideClick para que sea verdadero al cargar, de modo que la alerta sea visible durante toda la solicitud.

 Swal.fire({ title: 'title', text: "content", icon: 'info', showCancelButton: true, confirmButtonText: 'بله ایجاد کن', cancelButtonText : 'لغو', allowOutsideClick: () => !Swal.isLoading(), preConfirm: function(result) { if (result) { return @this.call('createRequest').then(() => { Swal.fire('Loading complete'); }); } }, });
about 4 years ago · Juan Pablo Isaza 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!