layui校验数据后关闭layer弹窗的示例代码

  
layui校验数据后关闭layer弹窗的示例代码,具体代码如下:
 $.ajax({
            url:"/other/notice_push",
            data:{title:title,content:content},
            type: 'POST',
            dataType: 'json',
            success: function(res){
                if(res.code == 200){
                    layer.msg(res.msg,{icon:6,time:2000});
                    setTimeout(function(){   
                        window.parent.location.reload();
                        //关闭当前窗口刷新
                    },2000);
                }else{
                    layer.msg(res.msg,{icon:5,time:3000});
                }
            }
        })

 
 
相关文章