How do I redirect users after submit button click?

2020-02-05 07:02发布

How do I redirect users after submit button click? My javascript isn't working:

Javascript

<script type="text/javascript" language="javascript">
function redirect()
{
    window.location.href="login.php";
}
</script>

Form Page

<form  name="form1" id="form1" method="post">  
    <input type="submit" class="button4" name="order" 
        id="order" value="Place Order" onclick="redirect();" >
</form>

标签: javascript
7条回答
来,给爷笑一个
2楼-- · 2020-02-05 08:02

Using jquery you can do it this way

$("#order").click(function(e){
    e.preventDefault();
    window.location="login.php";
});

Also in HMTL you can do it this way

<form name="frm" action="login.php" method="POST">
...
</form>

Hope this helps

查看更多
登录 后发表回答