Hi All
Stupid question (I seem to be leading all my questions with this phrase), but I was wondering if anyone out there had an elegant solution for processing forms via php and jquery and then redirects
[HTML FORM] --> submits via jquery post to --> [PHP FILE] --> upon success redirects to --> [SUCCESS HTML PAGE] (and if not success returns back to [HTML FORM]
HTML FORM example
<form action="procRegister.php" method ="post" id="registerAccount" name="registerAccount">
...fields here ladeeda...
</form>
JQUERY POST example
$("form#registerAccount").submit(function(){
$.post(
"procRegister.php",
$("form#registerAccount").serialize(),
function(data){alert(data.msg);},
'json'
);
return false;
});
PHP PROCESSING example
<?php
header('Content-type: application/json');
$return['msg'] = 'Alright!';
echo json_encode($return);
?>
If everything works correctly then the page would pop up an alert box saying "Alright!". Now, how and where would I implement the redirect upon success? i.e. Instead of sending "Alright" how would I redirect the user to, say a CONFIRMATION page?