1
I have a bizarre problem that’s making me pull my hair out, I know I’m creating a valid json via server side, I even used a json validator. the format of my json is that way:
[
{
"name": "jhon doe",
"age": "22",
"eye": "brown"
},
{
"name": "amanda",
"age": "26",
"eye": "blond"
}
]
By instantiating the datatables, it brings me all the results at once. not page, and the option to filter so that only 10 results come at a time also does not work. here’s my javascript code:
$('#list_table').DataTable({
processing: true,
serverSide: true,
language: language,
ajax: {
url: 'myurl.dev/fetchdata',
dataType: 'json',
dataSrc: ''
},
columns: [
{ data: "name" },
{ data: "age" },
{ data: "eye" }
],
responsive: true,
autoWidth: false,
order: [0, 'desc'],
lengthMenu: [[10, 25, 50, -1], [10, 25, 50, "All"]]
});
when checking the network tab -> XHR. I see that the answer brings me the result like this:
what else can I do to make it work properly? is the first time I’m dealing with this problem using datatables.