I\'m trying to figure out how to use the ajax option in DataTables 1.10. For the life of me, I cannot figure out how it works.
My server-side request, when queried, resp
dataSrc
should be a sub-property of ajax
option.columns
if data elements appear in sequential orderYour JSON response appears to be invalid. Correct response should be
{
"success": true,
"history": [
["John Doe","02 Mar 2016","Area 1","Value A","May 15","200"],
["Jane Doe","29 Feb 2016","Area 2","Value B","Apr 15","100"]
]
}
Corrected code is shown below:
$("#history-table").DataTable({
'ajax': {
'url': "/some-path-here",
'type': "POST",
'data': { 'pid': pID },
'dataSrc': 'history'
},
'autoWidth': false,
'lengthChange': false,
'ordering': false,
'pageLength': 50
});
See this jsFiddle for code and demonstration.