I'm trying to send an axios request that contains a list of parameters, which are from JSON.stringify
:
axios
.post('../procesarProductos/2/'+JSON.stringify({
id: this.id,
cantidad: this.cantidad,
nombre: this.nombre,
precioventa: this.precioventa,
precioproveedor: this.precioproveedor,
imgurl: this.imgurl
})+'/0/'+this.idafiliado) //Filtros
.then(response => (this.productos = response.data))
this.limipiar();
swal("El producto ha sido actualizado", "", "success");
The PHP file i have this:
$elProducto = json_decode($params);
$id=$elProducto->id;
$nombre=$elProducto->nombre;
$precioventa=$elProducto->precioventa;
$precioproveedor=$elProducto->precioproveedor;
$imgurl=$elProducto->imgurl;
$cantidad=$elProducto->cantidad;
$producto->modificarProducto($id,$idafiliado,$nombre,$precioventa,$precioproveedor,$imgurl,$cantidad);
return $producto->listarProductos($idafiliado);
The problem is when i received the string with // or # JSON doesn't work, or well i'm not sure, that's what i think.