Having issues populating DataTable from ajax query Using JavaScriptSerializer

Having issues populating DataTable from ajax query Using JavaScriptSerializer

DiggerDigger Posts: 1Questions: 1Answers: 0

Hi,
In my Java Script I'm trying to update my dataTable...

$(document).ready(function () {
$('#myDTTable').dataTable({
"iTotalDisplayRecords": 10,
"dataSrc": "",
"ajax": "/Home/GetDownTimeSpData/TF01",
"aoColumns": [
{ "mDataProp": "Duration" },
{ "mDataProp": "Type" },
{ "mDataProp": "Reason" },
{ "mDataProp": "Reason3" }
]

});

});

Data returned by ajax is....
[{"Duration":"41.2","Type":"Planned","Reason":"Setup","Reason3":"Bob"},{"Duration":"41.2","Type":"Planned","Reason":"Setup","Reason3":"Dean"},{"Duration":"41.2","Type":"Planned","Reason":"Setup","Reason3":"James"}]

Error in jquery.dataTables.js
Uncaught TypeError: Cannot read property 'length' of undefined

// Got the data - add it to the table
for ( i=0 ; i<aData.length ; i++ ) {
_fnAddData( settings, aData[i] );
}

Where am I going wrong?

This discussion has been closed.