1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
| <script src="{% static 'jquery.js' %}"></script> <script src="{% static 'bootstrap-3.3.7-dist/js/bootstrap.min.js' %}"></script> <script src="{% static 'tankuang/dist/sweetalert.min.js' %}"></script> <script> $(".delete_btn").on("click", function () { var ths = $(this); swal({ title: "are you sure?", text: "滚!", type: "warning", showCancelButton: true, confirmButtonClass: "btn-danger", confirmButtonText: "再见", cancelButtonText: "容我三思", closeOnConfirm: false }, function () { var deleteId = ths.attr('xxoo'); console.log('>>>>>',deleteId); $.ajax({ url: "/book/swal_delete/", type: "post", data: {"id": deleteId}, success: function (data) { if (data.status === 1) { swal("删除成功!", "你可以准备跑路了!", "success"); ths.parent().parent().remove(); var tr_first_td = $('tr .first_child'); for (var i=0;i<tr_first_td.length;i++){ var a = i+1; $('tr .first_child').eq(i).text(a); } } else { swal("删除失败", "你可以再尝试一下!", "error"); } } }) }); }) </script>
|