下面是我用来提交表单的jQuery代码,但是它仅在我第二次单击按钮时提交。
$cansend = false;
$("#submitbtn").on('click', function() {
$.confirm({
title: "<i class='fa fa-info'></i> Do backup before PROCEED. (PROCESS WILL OVER-WRITE CORRESPONDING MASTER TABLE IN CRM SYSTEM)",
text: "Confirm?",
confirmButton: 'Yes',
confirmButtonClass: 'btn-success',
confirm: function(button) {
$cansend = true;
form.submit();
},
cancelButton: 'No',
cancelButtonClass: 'btn-danger',
cancel: function(button) {
$cansend = false;
}
});
if ($cansend == true) {
$cansend = false;
return true;
} else {
return false;
}
});
当我单击YES按钮单击POP-UP时,它当时不提交表单。但是它在第二次提交。我第一次需要它。