How do I set the request method to GET for search, POST for everything else?
How do I set the request method to GET for search, POST for everything else?

I recently upgraded DT (from 1.10.15) to the latest version (1.10.21) and I noticed that all AJAX calls now use the request method that's specified in ajax: { type: "POST", ... }
. This was a little surprising to me because the search function in my back end looks for a GET
request which I presume was the default back in 1.10.15 even when the AJAX type was set to POST
. I'd like to avoid reworking the search function so I was wondering if it's possible to set the request method for search requests to GET
and leave it as POST
for everything else.
Answers
I don' think there was any chance in this area between .15 and .21. The default is
GET
and if you specifytype: 'POST'
then all Ajax requests DataTables makes will bePOST
.Can you give me a link to your page please? I don't actually quite understand the setup here - are you using
serverSide
to enable server-side processing? If not, how is the search working that it needs to hit the server?Allan