swal() 弹出删除确认框

//删除
function del() {

var id = "";
var row = $.map($("#DataList").bootstrapTable('getSelections'), function (row) {
id = row.Id;
return row;
});
if (row == null || row.length <= 0) {
swal("提示信息", "请选择要删除的记录!", IconMsg.WARNING);
return false;
}
swal({
title: "确定删除选中的记录?",
text: "删除之后无法恢复该数据!",
type: IconMsg.WARNING,
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: "确定",
closeOnConfirm: false
},
function () {
$.ajax({
type: 'post',
url: '/Users/DelUserById',
dataType: "json",
data: { id: id },
success: function (data) {
if (data.Result) {
$("#DataList").bootstrapTable('refresh');
swal("提示信息", data.Msg, data.IconMsg);
} else {
swal("提示信息", data.Msg, data.IconMsg);
}
}
});

});

前台页面上显示:

closeOnConfirm: false / true 

关闭确认 

猜你喜欢

转载自www.cnblogs.com/oyw911/p/10094917.html
今日推荐