I have a page with a form on it that needs to post to an external URL. However, I also need this information to be sent to the current page (mypage.php). For security reasons, I cannot just post to mypage.php and use cURL to post via PHP to the external site - the form has to submit directly to the external site.
This code would be found on mypage.php and does not work (I assume that the submit of myform is not waiting for post):
$('#myform').submit(function() {
$.post('mypage.php', serialized_form,
function(data) {
...
}, 'html'
);
}
...
<form id="myform" action="http://example.org" method="post">
...
</form>
What is the best way to do something like this?
Thanks!