Search code examples
datatables

DataTables server-side processing URL too long


Is there a way I can stop it from sending all of the columns to the server?

Currently the AJAX request looks like:

ssp.php?draw=2&columns%5B0%5D%5Bdata%5D=id&columns%5B0%5D%5Bname%5D=&order%5B0%5D%5Bcolumn%5D=10&order%5B0%5D%5Bdir%5D=asc&start=0&length=10&search%5Bvalue%5D=&search%5Bregex%5D=false&_=1448240832750

But it's 5689 characters long. I'm looking for a way to disable all of the column data that isn't necessary. Is this possible?


Solution

  • 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"
            },
        };
    });