jquery

使用场景:

    使用swal进行确认,是否执行某件事之后,点击确定之后,弹出成功或者失败的弹框

   关键设置    closeOnConfirm:false

 swal({
        title: '确定要删除【'+name+'】模板吗?',
        text: '',
        type: 'warning',
        showCancelButton: true,
        confirmButtonColor: "#DD6B55", //可有可无
        confirmButtonText: "确定",   //可有可无
        closeOnConfirm: false    //必须设置为false
    }, function (isConfirm) {
        if(isConfirm){
            // swal.disableButtons();
            loadDataByAjax(url, params, function (data) {
                if (data.status == 'success') {
                    swalsuccess();     //这里才能进行弹出
                    getDataOfCon();
                }else{
                    swal('', data.status, 'warning');
                };
            });
        }
        
    })

点击确定之后,请求成功 

原文地址:https://www.cnblogs.com/fyjz/p/12922477.html