0

I want to delete a record with PHP, if want to have confirmation yes and no, after clicking yes I want to show another message that the operation was successfully done. But my code doesn;t delete the record, if I remove event.preventDefault() then it deletes the record without any alerts, here is my code:

function archiveFunction() {
 
        
event.preventDefault(); // prevent form submit
var form = event.target.form;



  swal({
  title: "آیا مطمین هستید ",
  text: "",
  type: "warning",
  showCancelButton: true,
  confirmButtonColor: "#DD6B55",
  confirmButtonText: "Yes",
  cancelButtonText: "No",
  closeOnConfirm: false,
  closeOnCancel: false
  },
  function(isConfirm){
  if (isConfirm) {
  swal("ِمعلومات شما موفقانه ثبت سیستم شد","","success")
            window.setTimeout(function(){ 
               window.location = "delete_hospital_details.php";
        } ,1000);
  } else {
  swal("Cancelled", "معلومات ثیت سیتم نشد)", "error");
  }
  });
  }
DarkMode
  • 9
  • 2

0 Answers0