I'm doing a shipment by ajax from js to php.
I am sending an array of objects using angular, here my code.
$scope.updateRecipe = function()
{
//Se hace petición ajax para agregar el producto
$http(
{
//Se elige el metodo de la consulta
method: 'POST',
//Cabecera
headers:{'X-CSRF-TOKEN':$('input[name="_token"]').val()},
//Data
data:$scope.arrayObject,
//Se ingeresa la ruta de la consulta
url: './ruta'
})
//Si hay una respuesta positiva
.then(function (response)
{
//Respuesta
});
};
The array is as follows
[
{"idItem":68,"item":"salsa piña","quantity":1,"unit":"Gramo","idProduct":80,"deletable":false,"isNew":false}
,{"idItem":71,"item":"salsa mostaza","quantity":1,"unit":"Gramo","idProduct":80,"deletable":false,"isNew":false}
,{"idItem":79,"item":"","quantity":2,"unit":"Kilogramo","idProduct":0,"deletable":false,"isNew":true}
]
The problem is that when it arrives at php it is shown in the following way
[0] => stdClass Object
(
[idItem] => 68
[item] => salsa piña
[quantity] => 1
[unit] => Gramo
[idProduct] => 80
[deletable] =>
[isNew] =>
)
[1] => stdClass Object
(
[idItem] => 71
[item] => salsa mostaza
[quantity] => 1
[unit] => Gramo
[idProduct] => 80
[deletable] =>
[isNew] =>
)
[2] => stdClass Object
(
[idItem] => 79
[item] =>
[quantity] => 2
[unit] => Kilogramo
[idProduct] => 0
[deletable] =>
[isNew] => 1
)
The values of some variables disappear ...
They know why this can happen