私は次のjavascriptとjqueryコードを持っており、チェックされた行を更新し、各datatables行でいくつかの処理を実行します。これが私のコードです:
function checkUpdate(){
setInterval(function(){
var listLength = updateList.length;
if(listLength > 0){
for(var r=0; r<listLength; r++){
// console.log(r)
var clID = updateList[r];
// console.log(clID)
var rRow = $('#dataTable tbody tr').find('td[data-clientid="'+clID+'"]').parent('tr');
// console.log(rRow)
var rRowIndex = rRow.index();
// console.log(rRowIndex)
var rRowDataIndex = oTable.fnGetPosition(rRow[0]);
console.log(rRowDataIndex)
$.ajax({
url: '/cgi-bin/if-Clients-list.jpl',
data: 'session=' + recievedSession + '&clientid=' + clID + '&outputformat=json',
dataType: 'json',
success: function(rowData){
// console.log(rowData)
var newRow = [];
var newOrderedRow = [];
console.log(rRowDataIndex)
newRow.push(rRowDataIndex+1, "");
for (var title in rowData[0]){
newRow.push(rowData[0][title]);
}
console.log(newRow)
},
});
};
}
},2000)
};
ここに問題があります:呼び出し
後、変数が更新されないか、更新されますが、スコープと優先順位に問題があり、2行以上をチェックすると、すべての最初の要素が同じになります。自分?PS。
私はすべての体に感謝してウェブ上でコードを提示することもできません$.ajax()
rRowDataIndex
console.log(newRow)