Suppress unnecessary parameters in datatables ajax request?
I figured out a decent way to resolve this issue. Datatables provides a built-in method to mutate the ajax query parameters called just prior to making the request. You can specify it like this. In my case, I don't care about the entire columns
array attribute, so I just remove it.
var options = {
sDom: "lftip",
/* set your options to suit your taste */
};
options.ajax = {
url: ajaxUrl,
data: function(data) {
// manipulate data used in ajax request prior to server call
delete data.columns;
}
};
$el.dataTable(options);
It's also possible to send the query via POST to avoid any URL length limits
$(document).ready(function() {
$('#example').DataTable( {
"processing": true,
"serverSide": true,
"ajax": {
"url": "scripts/post.php",
"type": "POST"
}
} );
} );
https://datatables.net/examples/server_side/post.html