I need help with my php code, I do not know if I'm doing it right but ... I have this script:
$('#procesaPedido').on('click', function() {
var storage = {};
for ( var i = 0, len = localStorage.length; i < len; ++i ) {
var key = localStorage.key(i);
storage[localStorage.key( i )] = localStorage[key];
}
var carritojs=JSON.stringify(storage);
$.ajax({
type:"POST",
data:{"carrito":carritojs},
success:function(data){
console.log("enviado");
}
});
});
and it is sent to the same page that is php where I have:
<?php
if(isset($_POST['carrito']))
{
echo $_POST['carrito'];
exit;
}
?>
This does not show me the echo, I do not know if the item did not arrive at php or if I can not show it in this way it helps