I am trying to use jquery to submit a form, but instead of the default action script that is in the form, I would like to submit the post variables to different action script instead.
More specifically, this is my default form that works a particular way when a user clicks the submit button:
<form method="post" action="something.php" id="myForm">
</form>
What I am trying to do is submit the form above, but instead of using the default something.php as the action script I would like to use the foo.php.
Is this even possible? This is what I tried, with no success (the post vars arent getting passed to the foo.php page):
$.post('foo.php', '#myForm', function(data) {
alert(data);
});
I appreciate any suggestions on how to do this.
Many thanks in advance!