jquery-confirm插件使用

来源:互联网 发布:js身份证号正则表达式 编辑:程序博客网 时间:2024/05/21 09:51

插件下载

百度搜索 jquery-confirm,这里不再提供相关链接

示例代码

<!DOCTYPE html><html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Insert title here</title>    <script src="/js/jquery-3.1.0.min.js"></script>    <link href="/css/confirm/jquery-confirm.min.css" rel="stylesheet">    <script src="/js/confirm/jquery-confirm.min.js"></script></head><body>    <a href="javascript:void(0);" onclick="delete(1)">测试删除</a>    <script type="text/javascript">    function delete(id) {        $.confirm({            theme: 'black',             icon: 'fa fa-warning',            title: '警告',            content: '确认删除该记录?',            confirmButton: '是的',            cancelButton: '不,先留着',            confirm: function () {                $.ajax({                    type: "GET",                    url: "#",                     data: {"id":id},                    cache: false,                    async: false,                    dataType: "json",                    success: function(data){                        var json = data;                        if (json.status == 0) {                            $.alert({                                theme: 'black',                                 title: '提醒',                                content: '删除成功',                                confirmButton: '好哒',                                confirm: function(){                                    window.location.reload();                                }                            });                        }                    },                    error: function(XMLHttpRequest, textStatus, errorThrown) {                        alert(errorThrown);                    }                });            },            cancel: function () {            }        });    }    </script></body></html>

显示效果

这里写图片描述

阅读全文
0 0
原创粉丝点击