What to do when you have large number of query in one url

What to do when you have large number of query in one url

nilayy1234nilayy1234 Posts: 1Questions: 1Answers: 0

Hey I am getting this "Failed to load resource: the server responded with a status of 414 (Request-URI Too Large)" Is there any way how to fix this

This question has an accepted answers - jump to answer

Answers

  • n403729w735708n403729w735708 Posts: 26Questions: 6Answers: 4

    Did you ever figure this out? I think there is a way to modify the request and I'm also looking for documentation.

  • allanallan Posts: 63,075Questions: 1Answers: 10,384 Site admin

    I'm going to guess you are making a server-side processing request. If so, I would suggest you use POST rather than GET. See this example.

    Allan

  • n403729w735708n403729w735708 Posts: 26Questions: 6Answers: 4

    @allan yes this helped although, I get 400 bad request from jquery 2.1.4. I will try to make an example and post.

  • n403729w735708n403729w735708 Posts: 26Questions: 6Answers: 4

    My 404 issue was that I needed to change my route server-side from router.get to router.post (node.js) app.

  • n403729w735708n403729w735708 Posts: 26Questions: 6Answers: 4

    @allan before changing to POST, I referenced the filters like so:
    req.query.columns[3]

    Now with POST, data looks like this in the logs:
    draw=1, columns[0][data]=0, columns[0][name]=, columns[0][searchable]=true etc..
    I tried using dataType json but I can't seem to reference the columns.

  • n403729w735708n403729w735708 Posts: 26Questions: 6Answers: 4
    Answer ✓

    Figured it out:

    from the client side:
    ajax: {
    "url": "/historyData",
    "type": "POST",
    data: function ( d ) {
    return { 'd': JSON.stringify( d ) };
    }
    }
    from the server side (node.js on express):
    var mybody = JSON.parse(req.body.d);
    mybody.columns[3].search.value

    Found one of @allan 's comments from another post:
    https://github.com/DataTables/DataTables/issues/311

This discussion has been closed.