//弹框
function openAlert(self) {
// let $modal = $('#modal');
layer.open({
type:2,
content:'editStudent?studentId=1',
id:'888',
area:['900px','600px'],
cancel:function(){
window.location.reload();
}
})
}
其他案例:
function deleteEvent($this) {
var stuId = $this.parent('div').data('stuid');
layer.alert('确定要删除吗', {
icon: 6,
btn:['确定','取消'],
btn1:function () {
let api = '/api/student/'+stuId;
$.ajax({
url : api,
type : "DELETE",
success : function(result){
console.log(api);
alert(JSON.stringify(result))
if(result.msg=='ok') {
// alert(result);
console.log("删除成功")
layer.closeAll()
window.location.reload()
}
}
})
console.log("删除"+stuId);
},
btn2: function () {
console.log("取消删除"+stuId);
}
});
}
function openAlert($self) {
// let $modal = $('#modal');
let url = 'editStudent?studentId='+$self.parent('div').data('stuid');
layer.open({
type:2,
content:url,
id:'888',
area:['900px','600px'],
cancel:function(){
window.location.reload();
}
})
}