html 代码
在script中
1:绑定点击事件
2:comfirm 的值是否为确认删除
3:comfirm的值为true 则发送ajax执行删除;comfirm的值为false则返回false
$('.delete').click(function (){
var id = $(this).attr('id');
var _this = $(this);
if (confirm("您确认要删除吗?")==true){
$.ajax({
url:'delete',
data:{id:id},
success:function (e){
if (e.code==200){
_this.closest('td').parent('tr').remove();
}else {
alert("删除失败");
}
}
})
}else {
return false;
}
})