更改输入类型以表单形式提交的重定向路径URL

时间:2019-06-04 02:10:16

标签: jquery wordpress

我的表单具有此注册html代码,我想更改输入类型“提交”按钮上的url路径。另外,我希望它成功登录该页面。

我试过了,但是没用

$("#pop_signup_submit").click(function(e) {
    var form = $("#js_signup");
    form.prop("action","https://by2hands.com/vendor_dashboard/");
    form.submit();
});

这是html代码:

<form method="post" id="js_signup" class="login_account_form">

    <p class="text_style1 form-row form-row-wide field-align-right">                                                        
        <input type="email" class="input-text" name="email" id="reg_email_header" value="" placeholder="Indtast e-mail" />
    </p>

    <p class="text_style1 form-row form-row-wide field-align-right">
        <input type="password" class="input-text" name="password" id="reg_password_header"  placeholder="Indtast adgangskode" />
    </p>

    <p class="forgetmenot">
        <input class="input-checkbox" id="apply_for_vendor"  type="checkbox" name="apply_for_vendor" value="1"/>
        <label for="apply_for_vendor">Apply to become a vendor?</label>                                                                              
    </p>                                                                                                                                        
    <p class="register_submit signup_page">                                                             
        <span class="btn_spn">
            <input id="pop_signup_submit" type="submit" name="register_header" value="Tilmeld">
            <span class="loader_reg" style="display:none;" ></span>
        </span> 
        <span class="link_spn">
            <a class="header_login header_login_color signup-link" href="javascript:void(0)">Login</a>
        </span>
        <input type="hidden" id="_wpnonce" name="_wpnonce" value="70c2c9e9dd">
        <input type="hidden" name="_wp_http_referer" id="wp_http_referer2" value="//by2hands.com/inspiration/hyggelige-bamser/">    
    </p>

</form>

2 个答案:

答案 0 :(得分:0)

提交表单后,您可以尝试使用PHP代码。这是例子

<?php

if( isset($_POST['submit']) ){

    /* Your Form Submitted now here add redirect code */
    header('Location: https://by2hands.com/vendor_dashboard/');

}

?>

答案 1 :(得分:0)

这是可行的解决方案。

$(document).ready(function(){

    $("#wp_http_referer2").val("https://by2hands.com/vendor_dashboard/");

});