如何用jQuery獲取選中行固定列的數據

[本文出自天外歸雲的博客園]ajax

問題:把選中行的ID統計出來,組成一個數組傳給後臺(選中行的特色:class爲danger)數組

辦法以下:this

// 多選後點擊下線按鈕
$("#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();
        }
    });
});
相關文章
相關標籤/搜索