php中的删除 php代码
$(‘.del‘).click(function(){
var id = $(this).data(‘id‘);
var that = $(this);
layer.confirm(‘确定删除‘ + id + ‘吗?‘, {
icon: 3,
title: ‘提示‘
},
function(index){
$.ajax({
url:"/json.php",
type: ‘post‘,
data: {id:id},
dataType: ‘json‘,
success: function(res) {
console.log(res);
layer.close(index);
if (res.code == 1) {
// that.parents(‘tr‘).remove();
location.reload();
} else {
layer.msg(‘删除失败!‘);
}
}
});
});
});