HTML:
<form id="continue" action="summary.php" method="post">
<input type="submit" value="Continue" >
</form>
JS/JQuery
$('#continue').submit(function(){
var data = ["jon", "steve"];
var nameArray = JSON.stringify(data);
$.post("summary.php", { nameArray: nameArray });
});
PHP
$name = json_decode($_POST["nameArray"]);
print_r($name);
When I click the "Continue" button, I want to be redirected to the summary.php page and list the names. Currently, I get an "Undefined index: nameArray error when the summary.php page is loaded.
I checked firebug and there is no POST. So it looks like nameArray isn't even being posted either. What's the solution?