javascript - Do a jQuery/ajax POST on form submit -
i have html form this:
<form action="myserver.com/test.php" method="post"> ... </form>
when form submitted, user should redirected myserver.com/test.php , ofc send post data script. @ same time (or before), want post same post data script "myserver.com/test2.php".
$.post("myserver.com/test2.php", variablewiththeformpostdata);
i tried attach eventlistener form submit, doesn't seem work, maybe jquery post cant submitted fast enough before redirection?
i hope can me. :(
whenever use method onsubmit, make sure returns true, otherwise won't submit.
Comments
Post a Comment