出于某种原因,它只会删除第一行,不知道为什么。不删除其他行
function templatesArray(whatsThis) {
var myNewArray = new Array();
var aRow = new Array();
$('input:checkbox[name="templates"]:checked').each(function(i) {
myNewArray.push($(this).val());
aRow.push(oTable.fnGetPosition($(this).parents('tr').get(0)));
});
var dataString = 'templatesArray=' + myNewArray + '&deleteTemplatesArray=True';
$.ajax({
type: "POST",
url: "processes/templates.php",
data: dataString,
success: function(data) {
if (data.errorsExist) {
} else {
$(whatsThis).parents("tr").eq(0).hide();
for (i in aRow) // loop over the array of row indexes
oTable.fnDeleteRow(aRow[i]);
if(oTable.fnSettings().fnRecordsTotal() == 0) {
$('.bt_red').remove();
$('.bt_blue').remove();
}
if(oTable.fnSettings().fnRecordsTotal() <= 10) {
$('.bt_blue').remove();
}
if(oTable.fnSettings().fnRecordsTotal() <= 10) {
$('div.pagination').remove();
}
}
}
});
}
什么是oTable?标记在哪里?你需要比1班轮和一些代码更加冗长。 – madcapnmckay
http://jsfiddle.net/xtremer360/3Ldj5/它应该执行它所做的服务器端操作,然后从表中删除该行,但仅执行数组中的第一个操作。 –
为什么我的文章被编辑? –