在数据表加载期间出现错误“未捕获的TypeError:无法读取null的属性'error'”。以下是ajax调用并填充表的代码。该错误似乎是jquery数据表中的内部错误。如何检查返回的ajax响应中的空值
table = $('#data-table').DataTable({
destroy: true,
responsive: true,
serverSide: false,
autoWidth: false,
paging: true,
filter: true,
searching: true,
stateSave: true,
scrollX: true,
displayLength: 10,
language: {
"search": "Filtrer: "
},
ajax: {
url: '/Observer/GetActiveClientsByFloor',
type: 'POST',
data: {
FloorId: floorId,
TypeId: typeId
},
dataSrc: ''
},
columns: [
{
title: 'Zone',
data: 'LastKnownZone',
},
{
title: 'SSID',
data: 'ssId',
},
{
title: 'Status',
data: 'Statut',
},
],
createdRow: (row, data, dataIndex, cells) =>
{
const selectedRowProfileId = $('#selectedRowProfileId', window.parent.document).val();
}
},
initComplete: function (settings, json) {
clients = json;
console.log(clients);
if (clients.length !== 0) {
clients.forEach(client => {
});
}
}
}).order([[1, 'asc']]).draw(false);