Python--day72--SweetAlert插件

引用:http://www.cnblogs.com/liwenzhou/p/8718861.html

补充一个SweetAlert插件示例

 

点击下载Bootstrap-sweetalert项目

复制代码
$(".btn-danger").on("click", function () {
  swal({
    title: "你确定要删除吗?",
    text: "删除可就找不回来了哦!",
    type: "warning",
    showCancelButton: true, confirmButtonClass: "btn-danger", confirmButtonText: "删除", cancelButtonText: "取消", closeOnConfirm: false }, function () { var deleteId = $(this).parent().parent().attr("data_id"); $.ajax({ url: "/delete_book/", type: "post", data: {"id": deleteId}, success: function (data) { if (data.status === 1) { swal("删除成功!", "你可以准备跑路了!", "success"); } else { swal("删除失败", "你可以再尝试一下!", "error") } } }) }); })
复制代码

猜你喜欢

转载自www.cnblogs.com/xudj/p/10697341.html