I have a php multidimensional array:
$array[0] = array('Jack','[email protected]');
$array[1] = array('one'=>'test1','two'=>'test2'); //unknown data limit
it could be 5 or 10 or 100 items consider the second array as purchased products.
I want to send this array $array to the controller from the view. I tried:
$newArray = json_encode($array);
$.post('<?=base_url()?>controller/function/<?=$newArray ?>').done(function (res) {
alert(res);
});
But I get a security error can't send '[' or '{' in a url. and when I just echo $array in the post it won't work becuase the result will be: "Array".
So the question now is how to send this multidimensional array from view to controller in codeigniter?
$.post