javascript - Submit a form and Redirect the page -
i've seen lot of other questions related on so, none have worked me. trying submit post form , redirect user page, can't both happen. can either redirect, or post not both. here have now:
<html> <head> </head> <body> <script type="text/javascript"> function redirect() { window.location.href = "http://www.google.com"; } </script> <form id="myform" method=post name=transferform action="some_place.php" onsubmit="redirect();"> <input name=gold type=text value="1" size=5> <input name=recipient type=text value="mypal" size=10> <input id="mybutton" type=submit name=submission value="send"> </form> <script type="text/javascript"> window.onload = function(){ document.getelementbyid('mybutton').click(); }; </script> </body> </html> what doing wrong?
once submit form js execution on current page stops. need either redirect server, or have server spit out page containing javascript perform redirect.
Comments
Post a Comment