I am trying to pass two arrays to a php page like this:
- var mainFilter = getAllMainCheckedCheckboxesVals();
var subFilter = getAllSubCheckedCheckboxesVals();
JSON.stringify(mainFilter);
JSON.stringify(subFilter);
$.ajax({ url: 'process.php',
data: { mainFilter : mainFilter, subFilter : subFilter},
type: 'post',
success: function(output) {
if(output){
alert(output);
}
}
});
When I do this, all I get is the response, "Array". Here is my PHP code:
- $mainFilter=$_POST['mainFilter'];
if($mainFilter){
echo $mainFilter;
}
Shouldn't the arrays be in a string format?