layer.msg弹窗不关闭,更改内容。并设置延迟关闭

项目演示页面,在点击按钮后响应较慢,为了增进体验效果,先弹出窗口提示,等响应返回后修改提示内容。

弹窗内容自定义:

layer.msg('发送中......', {icon:1,area:['260px','200px']});
发送请求:
$.ajax({
    type: 'post',
    url: "/monitor/demos/testDemos",
    data: {},
    dataType: 'json',
    success: function (result) {
        if (result.flag ==true) {
            $("#confirm").text("场景模拟成功");
            setTimeout(function () {
                layer.closeAll();
            }, 6000);
        } 
    }
});

你可能感兴趣的:(web)