四、对于layer.confirm和ajax的冲突问题
2019-04-03 本文已影响0人
yuzhan550
table.on('tool(grade_set)', function(obj){
var $$ = layui.jquery;
var data = obj.data; //获得当前行数据, json obj, {'id':'1','name':'hello','level_id':1}
if( obj.event === 'del' ){
layer.confirm('真的删除吗?',{icon: 0}, function(index){
$$.ajax({
url:"/admin/Configuration/grade_del",
data:data,
success:function(res){
if( res.code == '0000' ){
obj.del();
layer.msg(res.msg,{icon:1,time:1800});
}else if( res.code == '0003' ){
layer.msg(res.msg,{icon:2,time:1800});
}
},
error:function(data){
layer.msg('操作错误,请刷新重试',{icon: 2,time:1800});
}
});
return false;
});
}
});