Ajax: with empty json, "processing" remains turned on
Ajax: with empty json, "processing" remains turned on
Hi,
i'm using datatables with ajax and **processing **set to true to show the loading view during the download of the data but.. when i have 0 data, so this json:
[{"data":[]}]
the loading view remains active
This is my init:
`var table = $('#table_id').DataTable({
"ajax": 'myajaxpage.php',
"processing": true,
responsive: true,
language: {
...
},
columnDefs: [ .... ],
"createdRow": function( row, data, dataIndex ){
// other operations ..
}
});
new $.fn.dataTable.FixedHeader( table );`
myajaxpage.php creates an array (with json_encode($myArr) ) returning [{"data":[]}] with no data and the correct data if something has to be returned.
What am i wrong ? Could you help me please? Thanks!
This question has an accepted answers - jump to answer
Answers
I think what you return should be:
{"data":[]}
The array you have the returned object in I think is causing the problem.
Kevin
It works greatly! Thank you!