Info added during fnServerData call not send to the server

Info added during fnServerData call not send to the server

didiergmdidiergm Posts: 14Questions: 0Answers: 0
edited April 2011 in General
Hello
An before anything else, a big thank you to Allan who created DataTables, this is an excellent piece of code. Yoyr efforts are much appreciated!

I have tried to learn by myself and not add to your workload, but I am stuck with a problem. Here is my code

oTable=$('#searchtable').dataTable( {
"bProcessing": true,
"bJQueryUI": true,

"bServerSide": true,
"sAjaxSource": "testdirect.php",
"fnServerData": function ( url, data, callback ) {
data.push( {"M": 'SYSTEM'});
data.push( {"S": 'PARAMS'});
data.push( {"ACTIONTYPE":'LIST'});
data.push( {"xyz":'LIST'});


$.ajax({
"dataType": "json",
"type": "POST",
"url": url,
"data": data,
"success": callback
});
},

"bPaginate": true,
"bLengthChange": false,
"bFilter": false,
"bSort": true,
"bInfo": false,
"bAutoWidth": true,
"iDisplayLength": 20,
"sDom": '<"H"p>tir',
"aoColumnDefs": [ { "bVisible": false, "aTargets": [ 0 ] } ],
"sPaginationType": "full_numbers"
// , "sPaginationType": "two-buttons"

});
but in the php script, I do net see the 4 fields I added

data.push( {"M": 'SYSTEM'});
data.push( {"S": 'PARAMS'});
data.push( {"ACTIONTYPE":'LIST'});
data.push( {"xyz":'LIST'});

when I log the $_REQUEST, after Bsortable_3, I get one field 'undefined'=undefined; I have tried surrounding the field names with single, double and no quotes, to no avail; I need to get $_REQUEST['M'] .. on the php side and I am at loss; it is probably obvious but I am failing miserable.

thanks in advance for your help

Didier

Replies

  • didiergmdidiergm Posts: 14Questions: 0Answers: 0
    No worries I found it; even if I read it 20 times (at least) it did not register in my brain that I needed to have a Name/value pair as in

    [code]data.push({name:'Whatever_name', value:"whatever_value"});[/code]

    So everything works now
This discussion has been closed.