sweetAlert回调

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/lovelovelovelovelo/article/details/80089467

这里写图片描述

swal({
    title: "保存成功",
    type: "success"
},function(isConfirm){
    callFunc();
});

这种单个按钮的回调参考多个按钮的回调即可
其实这个也是两个按钮,只是另外一个display:none
这里写图片描述

参考:
https://blog.csdn.net/qq_25821067/article/details/53365900

function check(id){  
       swal(  
            {title:"您确定要删除这条信息吗",  
            text:"删除后将无法恢复,请谨慎操作!",  
            type:"warning",  
            showCancelButton:true,  
            confirmButtonColor:"#DD6B55",  
            confirmButtonText:"是的,我要删除!",  
            cancelButtonText:"让我再考虑一下…",  
            closeOnConfirm:false,  
            closeOnCancel:false  
            },  
            function(isConfirm)  
            {  
                if(isConfirm)  
                {  
                    swal({title:"删除成功!",  
                        text:"您已经永久删除了这条信息。",  
                        type:"success"},function(){window.location="${pageContext.request.contextPath}/admin?action=deleteArticleById&id="+id})  
                }  
                else{  
                    swal({title:"已取消",  
                        text:"您取消了删除操作!",  
                        type:"error"})  
                }  
            }  
            )  
    }  

这里写图片描述

猜你喜欢

转载自blog.csdn.net/lovelovelovelovelo/article/details/80089467