1.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 });
}
});
转载自:https://www.cnblogs.com/linyongqin/articles/9326602.html
2、JavaScript严格模式
使用 "use strict" 指令
"use strict" 的目的是指定代码在严格条件下执行。
严格模式下你不能使用未声明的变量。
3、数组的新方法
some forEach filter findIndex
4、replace方法的第一个参数除了可写一个字符串之外,还可定义一个正则表达式。
string.replace默认只替换第一处,若是想全文替换,则第一个参数要写成正则