我有一个表,其中每行有一个删除按钮以这种形式如何使用确认(然后提交)使用甜蜜警报?
<form id="tableDelete_1">
<input type="hidden" name="tipo" value="delete" />
<input type="submit" name="send" value="Delete" class="btn btn-danger btn-xs" onClick="return confirm(`Are you sure?`)" />
</form>
<form id="tableDelete_2">
<input type="hidden" name="tipo" value="delete" />
<input type="submit" name="send" value="Delete" class="btn btn-danger btn-xs" onClick="return confirm(`Are you sure?`)" />
</form>
那么这个页面的底部
$(document).on('submit', '[id^=tableDelete_]' , function() {
return callAjax($(this).serialize());
});
function callAjax(data) {
$.ajax({
type : 'POST',
url : 'call/page.php',
data : data,
success : function(data) { ... },
error: function(data) { ... }
});
return false;
};
现在我想删除经典
并使用sweetalert ... 我刚开始的时候有问题,我只想显示带有此功能的弹出框
$(document).on('submit', '[id^=tableDelete_]' , function() {
swal({
title: "Are you sure?",
text: "You will not be able to recover this imaginary file!",
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: "Yes, delete it!",
closeOnConfirm: false
},
function(){
swal("Deleted!", "Your imaginary file has been deleted.", "success");
});
};
弹出只显示一秒钟,然后重新加载页面,因为我觉得在提交表单...
请给我帮助
随着e.preventDefault()弹出窗口不显示...确定返回false! 并感谢其余的功能 – FireFoxII