1.
官方给出的SweetAlert介绍是:SweetAlert可以替代JavaScript原生的alert和confirm等函数呈现的弹出提示框
swal("恭喜","添加成功","success");
第一个参数是title,
第二个参数是text,
第三个参数是提醒类型(success,error,warning,input)
2.cofirm弹框参数说明:
showCancelButton:是否显示取消按钮;
animation:提示框弹出时的动画效果,可选(pop、none、slide-from-top、slide-from-bottom);
timer:设置自动关闭提示框时间(毫秒);
showConfirmButton:是否显示确定按钮;
confirmButtonText:定义确定按钮文本;
cancelButtonText:定义取消按钮文本;
imageUrl:定义弹出框的图片地址;
官方给出的SweetAlert介绍是:SweetAlert可以替代JavaScript原生的alert和confirm等函数呈现的弹出提示框
swal("恭喜","添加成功","success");
第一个参数是title,
第二个参数是text,
第三个参数是提醒类型(success,error,warning,input)
2.cofirm弹框参数说明:
showCancelButton:是否显示取消按钮;
animation:提示框弹出时的动画效果,可选(pop、none、slide-from-top、slide-from-bottom);
timer:设置自动关闭提示框时间(毫秒);
showConfirmButton:是否显示确定按钮;
confirmButtonText:定义确定按钮文本;
cancelButtonText:定义取消按钮文本;
imageUrl:定义弹出框的图片地址;
回调函数:done()和error.
function deleteArticle(id){
//服务器调用接口
var serverAddress=serverAddressPath+'/api/arc/delete.shtml';
swal({
title:"",
text:"确定删除吗?",
type:"warning",
showCancelButton:"true",
showConfirmButton:"true",
confirmButtonText:"确定",
cancelButtonText:"取消",
animation:"slide-from-top"
},
function() {
var ids=new Array();
ids.push(id+"");
$.ajax({
type:"post",
url:serverAddress,
traditional: true,
dataType:"json",
data:{"id":ids}
}).done(function(data) {
swal("操作成功!", "已成功删除数据!", "success");
getMyArtic();
}).error(function(data) {
swal("OMG", "删除操作失败了!", "error");
});
}/*end*/);
}