Uncaught TypeError: Cannot read property 'length' of null
Uncaught TypeError: Cannot read property 'length' of null
kvn9328
Posts: 18Questions: 7Answers: 0
Hi,
My JSON response to Datatables looks like:
{"recordsTotal":0,"recordsFiltered":0,"draw":2,"data":null}
When rendering the datatable on the browser i can see this error:
Uncaught TypeError: Cannot read property 'length' of null
jquery.dataTables.js:2628_fnAjaxUpdateDraw jquery.dataTables.js:2628(anonymous function) jquery.dataTables.js:2474baseAjax.success
jquery.dataTables.js:2398c jquery-1.10.2.min.js:4p.fireWith jquery-1.10.2.min.js:4k jquery-1.10.2.min.js:6r
How do i deal with this situation?
Thanks!
This discussion has been closed.
Replies
I think i am returning JSON in wrong format.
Whenever my is "data":null, i am returning "data":[].
That fixed my problem.
Thanks!