Server processing - page number not work
Server processing - page number not work
Nomanoclass
Posts: 5Questions: 0Answers: 0
Hello,
I have edit the code of the exemples(https://www.datatables.net/examples/server_side/post.html)
$columns = array();
foreach($_POST["columns"] as $column)
{
array_push($columns, array("db" => $column["data"], "dt" => $column["data"]));
}
include_once("ssp.class.php");
echo json_encode(SSP::simple($_POST, $connection, $_POST["table"], $_POST["id"], $columns));
when I click on page number I have this error: "DataTables warning: table id=test - Invalid JSON response. For more information about this error, please see http://datatables.net/tn/1"
But "Previous" and "Next" work fine...
Thank you for your futur help.
This discussion has been closed.
Replies
try debugging in your network console what parameters are sent, and what data is returned when you press one of the numbers, and how it is different when you press the next or previous buttons.
make sure it lines up with the doccumentation here: https://datatables.net/manual/server-side
sounds like you could be getting a php error returned? remember when you are using server processing, it is up to the server to present the information data tables has requested, which means you will probably end up using most of the parameters passed.
I forgot to write it, there currently are no answer.
However, I will see what is sent.
EDIT:
parameters:
for next: start = 10
for 2: start = 0
and page number work if the "next" button has already gone on page number...
Did you follow the instructions in the tech note? If so, what is being returned that is making it invalid JSON?
Allan
Nothing is returned.
That would do it. An empty string is not valid JSON. There might be an error in the script when processing the first request - you might want to start by look in the server's error logs.
Allan
I have tested and it is certain pages who bug, I'll see what's wrong in these pages.
EDIT:
I think I found ... I warn you as soon as I finish the tests.
In ssp.class.php, the PDO connection hasn't set the charset to utf8...
Thank you very much for your responses.