400 Bad Request

400 Bad Request

slowawaysslowaways Posts: 3Questions: 1Answers: 0
edited May 2017 in Free community support

I have a table of 1305 columns and my JSON request length is over 193100 characters!
How to disable all default parameters?

My JavaScript:

        var table = $('#table').DataTable({
            ordering: false,
            searching: false,
            //paging: true,

            search: {"regex": false, "smart": false},
            //processing: true,
            serverSide: true,
            //deferRender: true,
            //deferLoading: 1116,

            ajax: {
                url: "result/data",
                type: "POST",
                data: function(data){
                    data.limit = 10;
                    data.offset = 0;
                }
            },
            columnDefs: [
                {
                    "defaultContent": "-",
                    "searchable": false,
                    "targets": '_all'
                }
            ],

            scrollX: true,
            scrollY: 200,
            lengthChange: false
        });

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,552Questions: 1Answers: 10,477 Site admin
    Answer ✓

    You can use ajax.data as a function to modify the data sent to the server. For example you could delete data.columns to remove the individual column information.

    404 is the wrong status code for a bad request btw. It should be 400 - 404 is not found.

    Allan

  • slowawaysslowaways Posts: 3Questions: 1Answers: 0

    Yes, it is 400 code, sorry.
    Can you give me an example in the code?

  • slowawaysslowaways Posts: 3Questions: 1Answers: 0

    Ok. I delete data.columns and this solve my issue! Thanks!

    ...
                    data: function(data){
                        delete data.columns;
                    }
    ...
    
This discussion has been closed.