I\'m using the jQuery Datatables plugin to enable pagination, sorting and searching with my tables. The elements are showing up but not working, and the pagination only sometime
With DataTables and calling a PHP-script with AJAX, be aware that you just must echo your array at the end. There is no need of encoding it first to a JSON object with json_encode.
So
header('Content-type:application/json;charset=utf-8');
echo $myArray // This will do. Do not use echo json_encode($myArray);
exit();
Otherwise you might end up with the dreadful error
Uncaught TypeError: Cannot use 'in' operator to search for 'length' in
or this one
Uncaught TypeError: Cannot read property 'length' of undefined