如何在单击“确定”按钮后重定向页面并在甜蜜警报上取消按钮?

问题描述 投票:-2回答:1

我想单击“确定”按钮,然后重定向到一个页面,然后单击“取消”按钮并重定向到另一个页面。我怎样才能做到这一点?

 function saveCase() {
      if (recordedFullSymptoms.length != 0 && cust_preferenceFile.patient.patientId == 0) {
       swal({
          text: "You can save the case by selecting or creating new patient.",
          buttons: true,
          confirmButtonText: "Ok",
          showCancelButton: true,
          closeOnCancel: true
       }).then(function() {
          if(okay) {
           alert(1);
            getPartialView('PatientList', this);
          }else{
            getPartialView('RepertoryList', this)
          }         
     })
    }
   else
     {
        swal("Please select atleast one symptom to save case.");
     }
    }
jquery sweetalert
1个回答
1
投票

将第二个函数传递给.then()

swal(...)
.then(function(){ //Ok button action

}, function(){ //Cancel button action

})
© www.soinside.com 2019 - 2024. All rights reserved.