customize callback
customize callback
I have a table with server side processing values.
I would like to display a value from ajax server side process that shows some informations about the search result.
So let's suppose i have a value stored in a variable ($x = "value to pass") and let's suppose this var is declared into the server side processing file...
how to pass this value to the table, for example, in the footer or header?
into the ssp file i have at the end the following code:
$json_data = array(
"draw" => intval( $requestData['draw'] ),
"recordsTotal" => intval( $totalData ),
"recordsFiltered" => intval( $totalFiltered ),
"data" => $data,
"cancellati" => intval( $iso )
);
echo json_encode($json_data, JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP | JSON_UNESCAPED_UNICODE);
So basically I don't know how to call values declared into ajax file into the table (header or footer)... or into the pageinfo.
Any idea?
Thanks in advance
Answers
Are you saying you want to return these values from your server script? If so use
ajax.json()
to get the latest Ajax response.Otherwise just use variables that can be accessed within the scope of your Datatable.
Kevin
i tried with this code but nothing happened, so i cannot see the alert content
...
Since ajax is an asynchronous process so the
table
variable hasn't been defined yet when line 5 executes. You will probably see an error in the browser's console. See the examples in thexhr
docs. Also note that the JSON is passed intoxhr
asjson
so you don't need the API.Kevin