I pass through 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 cannot use fooas an array using$cgi->param('foo[]')
CGI :: param, called in the context of the list from the main line 30 of the package, which can lead to vulnerabilities. See Warning in the section "Getting the value or values of a single named parameter."
It seems that all elements of the array are hard-coded into a parameter, for example 'foo [foo1]'.
Can I get dynamic access?
Conclusion 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' );
source
share