Error throwed when using ajax with json object
Error throwed when using ajax with json object
Hi,
I have a hkptu.json file. And I am using DataTable ajax with json object but when it load the json file, it throwed error as below.
Uncaught TypeError: Cannot read property 'length' of undefined
at jquery.dataTables.min.js:48
at i (jquery.dataTables.min.js:35)
at Object.success (jquery.dataTables.min.js:35)
at i (jquery.min.js:2)
at Object.fireWith [as resolveWith] (jquery.min.js:2)
at A (jquery.min.js:4)
at XMLHttpRequest.<anonymous> (jquery.min.js:4)
Answers
Could be the top FAQ: https://datatables.net/faqs/#Most-common-FAQs
I suspect that in this case the JSOn file doesn't have an array of data where the
ajax.dataSrc
parameter is pointing to. But difficult to say with either code or a test case...Allan