mDelshad
7 months ago

submit form with sweet alert

Posted 7 months ago by mDelshad

What is the problem with this code I want to submit if user click on confirm But in this code, if user click Cancel or outside of the sweet alert, the form will still be submitted

jQuery(document).ready(function(){
    jQuery('button#verifyDoc').on('click', function(){
      swal({
        title: "",
        text: "...",
        type: "info",
        showCancelButton: true,
            buttonsStyling: true,
        confirmButtonText: "ok",
        cancelButtonText: "cancel",
      }).then(function(isConfirm){
            if(isConfirm){
        jQuery("#verifyDocForm").submit();
            }
      });
    });
});

Please sign in or create an account to participate in this conversation.