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

102
Views
Cómo configurar las acciones de los botones Sí y No en el hipervínculo en SweetAlert

Tengo un hipervínculo como este:

 <a href="{{ route('courseRegistration', $item->cor_id) }}" class="btn btn-info" id="custombtn"> Register </a>

Luego agregué esto para mostrar un mensaje de Sweetalert con los botones Sí y No :

 $(document).on('click', '#custombtn', function(e) { e.preventDefault(); let form = $(this).parents('form'); swal( { title: "Alert!", text: "You have an active Wallet, do you wish to pay the price with the active Wallet?", type: "warning", allowEscapeKey: false, allowOutsideClick: false, showCancelButton: true, confirmButtonColor: "#DD6B55", confirmButtonText: "Yes", cancelButtonText: "No", showLoaderOnConfirm: true, closeOnConfirm: false }).then((isConfirm) => { if (isConfirm.value === true) { // go to the href route } return false; }); });

Como puede ver, quiero decir: si el usuario hizo clic en el botón Sí , vaya a la ruta href y, si no, permanece en la página ( return false ).

Entonces, la pregunta es, ¿cómo puedo redirigir al usuario a href="{{ route('courseRegistration', $item->cor_id) }}" , si hace clic en el botón Sí ?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

puede usar window.location.href = "YOURLINKHERE" para redirigir a otra página después de verificar si isConfirm.value está configurado (no tiene que verificar si es verdadero, ya que el botón cancelar no devuelve isConfirm.value)

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!