Help with POST requests
Help with POST requests
Hi,
I'm moving my DataTables fro GET to POST requests.
Using the following code:
"fnServerData": function ( sSource, aoData, fnCallback ) {
aoData.push( { "name": "q", "value": "undefined"});
$.ajax( {
"dataType": 'json',
"type": "GET",
"url": sSource,
"data": aoData,
"success": fnCallback
I get valid JSON returned and the table fills as expected.
However when I change the type to POST, I still get the JSON returned but table fails to draw. No errors just the ProcessingIndicator
All help gratefully accepted.
Thanks
I'm moving my DataTables fro GET to POST requests.
Using the following code:
"fnServerData": function ( sSource, aoData, fnCallback ) {
aoData.push( { "name": "q", "value": "undefined"});
$.ajax( {
"dataType": 'json',
"type": "GET",
"url": sSource,
"data": aoData,
"success": fnCallback
I get valid JSON returned and the table fills as expected.
However when I change the type to POST, I still get the JSON returned but table fails to draw. No errors just the ProcessingIndicator
All help gratefully accepted.
Thanks
This discussion has been closed.
Replies
The only difference between the JSON returned by GET and POST methods is the sEcho parameter.
In the GET request sEcho=1 whereas in the POST request sEcho=0
I have read something to do with sEcho=0 being for testing and therefore not displaying results.
More research required...
(a quick fix could be to merge the $_GET and $_POST arrays, add this to the top of your server_processing.php:
[code]
// http://php.net/manual/en/function.array-merge.php
$_GET = array_merge($_GET, $_POST);
[/code]
)
Ok I found the problem.
I'm using the Django SSP and realized that this is cast in GET.
Solved.
Hope this helps somebody.