How to handle when server side processign return empty result?
How to handle when server side processign return empty result?
udhaya2kmrv
Posts: 6Questions: 4Answers: 0
it showing invalid json format. It doest display no data found message:(
$('#example').dataTable( {
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "http://localhost/cig/pms/get_pending/"
} );
My responce
{"draw":6,"recordsTotal":4,"recordsFiltered":0,"data":[],"error":"failure"}
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
$.fn.dataTable.ext.errMode = 'none';
$('#YourTable').on('xhr.dt', dataTableAjaxReturn);
function dataTableAjaxReturn(e, settings, json) {
Thanks @survalent
I forget check server side
If server provide empty result thats a problem
if(count($data)>0)
//your data[]
endif;