layer弹出层的关闭及父页面的刷新问题

 

<a class="btn-refresh" href="javascript:;" onclick="javascript:location.replace(location.href);">刷新</a>

 

$(form).ajaxSubmit({
    type: 'POST',
    url: "/WebAdmin/Role/Add",
    success: function (res) {
        if (res.status == "ok") {
            parent.layer.msg('添加成功!', { icon: 1, time: 1000 }, function () {
                parent.$('.btn-refresh').click();
                //parent.location.reload(); //刷新父页面
                var index = parent.layer.getFrameIndex(window.name);
                parent.layer.close(index);
            });
        } else {
            layer.msg("Error:" + res.errorMsg, { icon: 5, time: 1000 });
        }
    },
    error: function (XmlHttpRequest, textStatus, errorThrown) {
        layer.msg('error!', { icon: 1, time: 1000 });
    }
});

 

posted @ 2018-07-17 23:11  linyongqin  阅读(4790)  评论(0编辑  收藏  举报