jquery.dataTables.min.js:39 Uncaught TypeError: Cannot read property 'length' of undefined
jquery.dataTables.min.js:39 Uncaught TypeError: Cannot read property 'length' of undefined
I'm simply calling DataTable with the following parameters
$('#datatable').DataTable({
columns: [
{ 'data': 'Id' },
{ 'data': 'FirstName' },
{ 'data': 'LastName' },
{ 'data': 'Gender' },
{ 'data': 'JobTitle' },
],
'bServerSide': 'true',
'sAjaxSource': 'EmployeeHandler.ashx',
});
but it says can not read property 'length' etc... I've tested my Generic Handler it retur results like i.e.
{"iTotalRecords":15,"iTotalDisplayRecords":15,"aData":[{"Id":1,"FirstName":"Mark","LastName":"Hastings","Gender":"Male ","JobTitle":"Developer"},{"Id":2,"FirstName":"Maria","LastName":"Nicholas","Gender":"Male ","JobTitle":"Developer"},{"Id":3,"FirstName":"Robert","LastName":"Stephenson","Gender":"Male ","JobTitle":"Developer"},{"Id":4,"FirstName":"Mary","LastName":"Quant","Gender":"Female ","JobTitle":"Sr. Developer"},{"Id":5,"FirstName":"John","LastName":"Stenson","Gender":"Male ","JobTitle":"Sr. Developer"},...
So, where is the problem?
This question has an accepted answers - jump to answer
Answers
My problem is solved, Here was the issue aaData = list , i was using aData instead of aaData.