DataTables server-side processing URL too long
if you use GET
try to remove unnecessary column.
$('#your-table').DataTable({
serverSide: true,
processing: true,
ajax: {
url: 'url-here',
data: function (data) {
for (var i = 0, len = data.columns.length; i < len; i++) {
if (! data.columns[i].search.value) delete data.columns[i].search;
if (data.columns[i].searchable === true) delete data.columns[i].searchable;
if (data.columns[i].orderable === true) delete data.columns[i].orderable;
if (data.columns[i].data === data.columns[i].name) delete data.columns[i].name;
}
delete data.search.regex;
}
}
})
You can send it via POST instead, so none of those fields will appear on the URL sent to your server. Here's an example from the docs:
$(document).ready(function() {
$('#example').DataTable( {
"serverSide": true,
"ajax": {
"url": "scripts/post.php",
"type": "POST"
},
};
});