can't load json data - error DataTables warning: table id=users - Unknown Parameter '0' for row 0
can't load json data - error DataTables warning: table id=users - Unknown Parameter '0' for row 0
This is what my code looks like: http://jsfiddle.net/e3nk137y/1515/
And this is the data that is being returned from my server:
{
"draw":1,
"recordsTotal":"62",
"data":
[
{"id":"228","available":"55555","name":"Jimmy","code":"12345"},
{"id":"229","available":"test@yahoo.com","name":"Jimmy","code":"12345"},
{"id":"230","available":"test@att.com","name":"Jimmy","code":"12345"},
{"id":"231","available":"test@tmomail.net","name":"Michael Doe","code":"23819"},
{"id":"232","available":"test@gmail.com","name":"Michael Doe","code":"23819"},
{"id":"233","available":"mDoe@yahoo.com","name":"Michael Doe","code":"23819"},
{"id":"234","available":"mDoe@gmail.com","name":"Michael Doe","code":"23819"},
{"id":"235","available":"36338","name":"Michael Doe","code":"23819"},
{"id":"236","available":"test@gmail.com","name":"Jane Doe","code":"23820"},
{"id":"237","available":"28519","name":"Jane Doe","code":"23820"}
],
"recordsFiltered":0
}
Is it because I'm returning an array of json objects instead of an array of arrays?
Answers
i added the following code and it seems to help:
$('#users').dataTable( {
"processing": true,
"serverSide": true,
"order":[[1,"asc"]],
"ajax": "/cgi-bin/widgets",
"columns":
[
{ "data": "id" },
{ "data": "available" },
{ "data": "name" },
{ "data": "code" }
]
} );