I pass via jquery
$.ajax({
'type' : 'POST',
'data' : {
'foo': {
'foo1':'bar1,
'foo2':'bar2'
}
},
'async' : false,
'global' : false,
'url' : "path/to/script.pl",
'dataType' : "json",
'success' : function(data) {
json = data;
},
'error' : function(jqxhr, textStatus, error) {
console.log("Request Failed: " + textStatus);
console.log(error);
}
});
to my cgi script.
HTML Parameter: foo%5Bfoo1%5D=bar1&foo%5Bfoo2%5D=bar2
I can't use foo as an array by using $cgi->param('foo[]')
CGI::param called in list context from package main line 30, this can lead to vulnerabilities. See the warning in "Fetching the value or values of a single named parameter
i seems that all array elements are hardcoded into parameter like 'foo[foo1]'.
is it possible to get dynamic access?
Output of use Data::Dumper; print Dumper scalar $cgi->Vars();
$VAR1 = bless( {
'use_tempfile' => 1,
'.fieldnames' => {},
'.charset' => 'ISO-8859-1',
'.parameters' => [
'foo[foo1]',
'foo[foo2]'
],
'escape' => 1,
'param' => {
'foo[foo2]' => [
'bar2'
],
'foo[foo1]' => [
'bar¹'
]
}
}, 'CGI' );
CGIis deprecated, although I appreciate that might not be something you can control. - Sobrique'foo[]'parameter, just'foo[foo2]'and'foo[foo1]'. Are you sure, jquery is sending in json format? - mpapec