{"draw": 1,"recordsTotal": 57,"recordsFiltered": 57,"data": [{"order_id": "56562","date": "2019-11-03"},{"order_id": "56614",{"order_id": "56621","date": "2019-11-03"}]}
<script>
// Call the dataTables jQuery plugin
$(document).ready(function() {
let searchParams = new URLSearchParams(window.location.search);
var dict = {};
for (const [key,value] of searchParams) {
//console.log(value);
//console.log(key);
dict[key] = value;
console.log(dict);
}
$('#dataTable').DataTable(
{
"processing": true,"serverSide": true,"ajax": {
"processing": true,"url": "/tasty/","data":dict,"dataSrc": ""
},"columns": [
{ "data": "order_id" },{ "data": "date" },],});
console.log(dict);
});
</script>
Datatables在HTML视图中未加载任何JSON数据。但是加载其他分页变量,例如总记录。过滤的记录等。所以有人可以指导我为什么不加载数据表,甚至连JSON响应都看起来不错