aoData.push size limit of vars

aoData.push size limit of vars

OsirisOsiris Posts: 36Questions: 0Answers: 0
edited September 2012 in DataTables 1.9
Hi,

Is there a variable size limit to what you can push using aoData.push ?
I'm sending my query (which varies) to the server processing page.
I'm choosing 'clients' in one page (in a datatable) ... this generates a query on a second page, which calls a third page : the server-processing.php.
It works perfectly, until I choose a client to many.

Is the query becoming too big to be sent as a $_GET variable ?
I've tried to send it as POST type, same result.
If I hardcode my php generated query into the processing page (as the table), the json shows perfectly.

Replies

  • allanallan Posts: 63,395Questions: 1Answers: 10,451 Site admin
    > Is there a variable size limit to what you can push using aoData.push ?

    I presume you mean for fnServerParams? In which case no - although obviously the more data to send the longer it takes, the slower the app is. Also many server's have a GET limit, so you might want to use POST.

    Allan
  • OsirisOsiris Posts: 36Questions: 0Answers: 0
    edited September 2012
    [code],"fnServerData": function ( sSource, aoData, fnCallback ) {
    aoData.push( { "name": "trueQuery", "value": "'.$query.'","type": "POST" } );
    ...[/code]
    fnServerData indeed.
    I've set all relevant vars in my server's php.ini to an astronomical size.

    I assume this variable can be cought through
    [code]$_POST['trueQuery'][/code]
  • allanallan Posts: 63,395Questions: 1Answers: 10,451 Site admin
    Heh - fair enough. There should be no limit other than bandwidth then :-)

    Allan
  • OsirisOsiris Posts: 36Questions: 0Answers: 0
    setting the type to POST doesn't seem to do anything.
    I can only catch the var through $_GET
  • OsirisOsiris Posts: 36Questions: 0Answers: 0
    edited September 2012
    something is going wrong in the translation of this var to php ... can't figure out how to effectively use the post variable in aoData.push.
    what's the code behind the aoData.push in fnServerData ?
    Are you escaping/encoding these vars somewhere ?

    I see it was already asked in this topic, but not directly answered.
    http://datatables.net/forums/discussion/1630/using-aodata-to-push-extra-things-to-a-php-file/p1
  • allanallan Posts: 63,395Questions: 1Answers: 10,451 Site admin
    The data object ( aoData ) is being passed to jQuery's Ajax handler as `data` ( http://api.jquery.com/jQuery.ajax/ ). There is no funky escaping or anything else going on - its simply passed to jQuery's Ajax handler. Indeed - if you are using fnServerData you must be calling $.ajax yourself... There is not code behind aoData.push - aoData is an array, so push is the [] native function.

    Allan
  • OsirisOsiris Posts: 36Questions: 0Answers: 0
    ok. An update.
    it isn't the jQuery as far as the request variables are concerned.
    Why the POST type isn't working, I'll find out later.

    The url with the $_GET vars actually gets cut off.
    Just found it in the access.log on the apache (so not in the error log since it's normal behaviour).
  • OsirisOsiris Posts: 36Questions: 0Answers: 0
    I've added the following line to httpd.conf on the apache server
    [code]LimitRequestLine 65536[/code]
    The default seems to be 4KB

    Problem solved.
    thx for all the feedback, Allan.
This discussion has been closed.