I'm stuck trying to pass an object to another page , using javascript. I hope you can give me a hand . Thanks.
Here the object created and sent through a form and input.
var cars = {nombre : "luis", apellido: "heya"};
var form = '<form action="RegisterOrder.php" method="post">'+'<input type="hidden" name="arrayDatosProductos" value="'+cars+'"></input>'+'</form>';
$(form).submit();
In the page that receives the object :
var a = new Object(<?php echo $_REQUEST['arrayDatosProductos']; ?>);
alert(a.nombre);
Aucun commentaire:
Enregistrer un commentaire