layui案例

 

 

删除:

if(layEvent === 'rp_del'){ 
    layer.confirm('真的删除行么', function(index){
        //向服务端发送删除指令
      	$.ajax({
      	    type:"post",
      	    url:"http://localhost:8080/ycoa/manage/rewardOrPunish/delete",
      	    data: {id:data.id},
      	    success: function(data){
      	        console.log(data.status);
      	        if (data.status == 0) {
      	            obj.del(); //删除对应行(tr)的DOM结构,并更新缓存
      	            layer.alert("删除成功", {icon: 6});
                }else {
                    var msg = data.msg;
                    layer.alert(msg, {icon: 5});
                }
      	       }
      	});
        layer.close(index);
    });
}
        	

 

你可能感兴趣的:(layui)