Ajax代码
function delAll(){
var ids = [];//定义一个空数组
$("input[name='check']:checked").each(function(i){//把所有被选中的复选框的值存入数组
ids[i] =$(this).val();
});
if(ids.length>0){
if(confirm("确认删除?")){
$.ajax({
url:"../res",
data:{"mark":"delResourcesByIds","ids":ids},
type:"post",
dataType:"json",
success:function(obj){
if(false == obj){
alert("删除失败");
}else{
alert("删除成功");
window.location.href ="../res?mark=findResourcesListFY";
}
}
});
}
}else{
alert("请选中要删除的项");
}
}
前台html代码
<input type="checkbox" name="check" value="${res.id }">
${