这里我给checkbox的name值是checkbox_
//全选
function checkAll() {
var check = $("input:checkbox[name='checkbox_']");
for (var i = check.length - 1; i >= 0; i--) {
check[i].checked=true;
}
}
全选删除
function deleteAll() {
var check = $("input:checkbox[name='checkbox_']");
var tb = $("#tb");
var s="";
for (var i = check.length - 1; i >= 0; i--) {
if (check[i].checked) {
//#tb是tbody的id值,寻找tr找到指定行,寻找td找到指定列的值
var card = $("#tb").find("tr").eq(i).find("td").eq(1).text();
s=s+card+",";
}
}
//进行批量ajax删除,提交数据xxx,xxx,xxx,xxx,
deleteCard(s);
}
//单个删除
function deleteCard(card) {
$.ajax({
url:'deleteCard',
type:'post',
data:{card:card},
success:function (msg) {
if (msg=='success'){
getlist(nowPage);
}else{
return false;
}
}
})
}