POST instead of GET with sAjaxSource
POST instead of GET with sAjaxSource
uskerine
Posts: 33Questions: 15Answers: 0
Hi,
I have the following datatables definition:
var oFooTable = $('#fooTable').dataTable({
"bJQueryUI": false,
"bAutoWidth": false,
"sPaginationType": "full_numbers",
"sDom": '<"datatable-header"fl><"datatable-scroll"t><"datatable-footer"ip>',
"aoColumnDefs": [
{ "bSortable": false, "aTargets": [ 6 ] },
{ "bVisible": false, "aTargets": [ 0 ] }
],
"sAjaxSource": "getFooList?type=SUPERFOO&status=FULLFOO"
});
This generates a GET method against server-side backend.
Is there any way to do exactly the same but with POST method instead of GET while using sAjaxSource?
Thanks,
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
You can use jQuery to retrieve the ajax data any way you want, preprocess it any way you want and then pass it to the dataTable constructor as
aaData
(instead ofsAjaxSource
).BTW: switching to new 1.10 API would be a good move, see http://www.datatables.net/upgrade/1.10
In the old 1.9 style you can use sServerMethod to set the HTTP method. In 1.10 use
ajax
'sajax.type
option to set the method (shown in the documentation forajax
).Allan
Great! Thanks!