layui执行添加或者修改后,重新加载数据表格数据(刷新页面动作)

这是点击编辑按钮执行的js,要想实现添加后刷新数据表格的动作,只需要加上

window.parent.location.reload();即可,亲测有效!!!
 //监听提交
        form.on('submit(edit)', function (data) {
            // 这个只是监听提交动作,自己还需要ajax提交
            $.ajax({
                async: false,
                url: "/updateMessage",
                data: data.field,
                type: "Post",
                dataType: "json",
                success: function (data) {
                    if (data === true) {
                        layer.alert("修改成功", {icon: 6}, function () {
                            // 获得frame索引
                            var index = parent.layer.getFrameIndex(window.name);
                            //关闭当前frame
                            parent.layer.close(index);
                            //修改成功后刷新父界面
                            window.parent.location.reload();
                        });
                    } else {
                        layer.msg("修改失败");
                    }
                }
            });

猜你喜欢

转载自blog.csdn.net/qq_40180411/article/details/88038234