Server side processing, URL too long

Server side processing, URL too long

coen56coen56 Posts: 3Questions: 1Answers: 0

I've got a data table showing one column per month, with website visitors defining the date range. This typically means dozens of columns

With server side processing, DataTables uses a very long URL to request the data, 6000+ characters or more. The server (AWS) throws an error when the URL gets too long, which regularly happens for this web page

For each column DataTables specifies (in the URL) the sort and search values, even though sorting and searching is disabled for this table. So this information is completely unnecessary in this case

Is there any way to not send the column-level data or otherwise limit the length of the URL

Note: The system is password protected, so I can't give a (usable) link. Hopefully you've got enough information, although I could probably create a dummy page if necessary. And I'm of course I'm happy to answer any question

Thanks, Coen

This question has an accepted answers - jump to answer

Answers

  • ignignoktignignokt Posts: 146Questions: 4Answers: 39
    Answer ✓

    By default, datatables uses GET instead of POST. Try changing the type to POST:

    var table = $('#mytable').DataTable({
        ajax: {
            url:"/my/url",
            type:"POST"
        }
    });
    
  • coen56coen56 Posts: 3Questions: 1Answers: 0

    Good thinking. I'll try that. Many thanks

  • coen56coen56 Posts: 3Questions: 1Answers: 0

    Yes, that worked. Problem solved. Thanks again

This discussion has been closed.