如何用jQuery获取选中行固定列的数据

时间:2023-03-09 15:30:21
如何用jQuery获取选中行固定列的数据

[本文出自天外归云的博客园]

问题:把选中行的ID统计出来,组成一个数组传给后台(选中行的特点:class为danger)

如何用jQuery获取选中行固定列的数据

办法如下:

// 多选后点击下线按钮
$("#offline").click(function () {
var idList = [];
$("tr.danger").each(function () {
idList.push($(this).children("td:eq(1)").text());
});
// console.log(idList);
$.ajax({
type: 'POST',
url: "请求路径",
data: {
"idList": idList,
...
},
success: function () {
window.location.reload();
}
});
});