I want to send an array of objects to a php controller, and im doing like this:
$http({
method: 'POST',
url: "payment/pagamento",
data: $.param(vm.listProdsCar),
headers: {'Content-Type': 'application/x-www-form-urlencoded'}
}).success(function(response) {
console.log(response);
}).error(function(response) {
console.log(response);
});
My array vm.listProdsCar
:
array
and in the php controller im reeiving like this but is not working:
foreach($request->all as $req){
echo '<script type="text/javascript">alert("'.$req->name.'");</script>'; }
Any ideas?