having trouble POSTing fnGetData to cgi script using ajax

having trouble POSTing fnGetData to cgi script using ajax

bigsipperbigsipper Posts: 31Questions: 2Answers: 0
edited February 2014 in DataTables 1.9
I want to pass DataTable contents to a cgi-bin script. I figured I would make one big object, and use fnGetData to store the table in the object - then pass the whole object using ajax POST.

Odd thing is that the DataTable rows are not being sent as an array, but as individual 'keys':

Parameters at the time I POST:
function drc
notify
requests[0][] -1
requests[0][] ass asdfasdf sadfaf sadfasfdf sasdf sad safdasdfaf sffadfasddfs a sadfsadfa f sd .
requests[0][] *
requests[0][] 02/13/2014
requests[0][] 05/09/2014
technology tsmc28hpm
tfid undefined

So in my cgi-bin program I can print:
[code]
$params{'requests[0][]'}
params{'requests[0][]'} = ARRAY(0x10520130)

[/code]
but can't print what I expected:
[code]
$params{'requests'}[0]
params{'requests'}[0] =
[/code]

Here's how I send the data... what gives? I don't understand why the DataTable rows are not being encoded as arrays of arrays and passed to my program as such - so I can loop through the rows and columns in order to do some processing.

[code]
$("#btnsave").on( 'click', function(e){
// Need to pass existing table data to cgi....
// using ajax to POST the table data in JSON format.
var id = ( tfid ? tfid : 'undefined' );
var aData = {};
aData["tfid"] = id;
aData["technology"] = $('#technology').val();
aData["function"] = $('#function').val();
aData["notify"] = $('#notify').val();
aData["requests"] = tableRequests.fnGetData();
$.ajax({
type: "POST",
url: "cgi-bin/save.cgi",
data: aData,
dataType: "json",
cache: false,
success: function(data){ console.log(data.msg); },
error : function(e, t, r ) {
alert("Error: " + r + " While calling cgi-bin/save.cgi. " + (e.responseText?e.responseText:''));
},
});
return false;
});
[/code]


fiddle here: http://jsfiddle.net/tPtm5/
This discussion has been closed.