重定向到下一页

时间:2014-06-25 11:30:09

标签: jquery html

我有一个有注册的锚标记,

<a class="event">Sign up</a> //

onclick注册,我需要重定向到其他形式,其id =“second”,如

<div id="second">
    <?php

           if(isset($_REQUEST['email']))
                $email=$_REQUEST['email'];
            else
                $email="";
            $signup_attributes = array(
            'class' => '',
            'id' => 'form-register',
            'method' => 'post',
            'autocomplete' => 'off');

            $full_name = array('name' => 'full_name',
            'type' => 'text',
            'class' => 'validate',
            'id' => 'full_name',
            'placeholder' => 'Your Name',
            'error-msg' => 'Please enter your name',
            'valid-name' => 'name',
            'maxlength' => '100'
            );

            $emailid = array('name' => 'emailid',
            'type' => 'email',
            'class' => 'validate',
            'id' => 'emailid',
            'placeholder' => 'Email',
            'valid-name' => 'email',
            'value' => $email,
            'maxlength' => '100');

            $password = array('name' => 'password',
            'type' => 'password',
            'class' => 'validate',
            'id' => 'password',
            'valid-name' => 'password',
            'placeholder' => 'Password',
            'maxlength' => '16');
            echo form_open('user/register', $signup_attributes);?>
                <div class="modal-login-container">
                    <!--
                    HEADER
                    ========================================================= -->
                    <div class="header">
                        <h2>sign up</h2>
                        <i data-dismiss="modal" aria-hidden="true" class="modern-pictograms-modal-login-close">&#8217;</i>
                    </div>

                    <!--
                    CONTENT
                    ========================================================= -->
                        <div class="content">
                            <div class="control-content">
                                <div class="form-control-group">
                                    <div class="control-group">
                                        <?php echo form_input($emailid); ?>
                                    </div>
                                </div>
                                <div class="form-control-group">
                                    <div class="control-group">
                                        <?php echo form_input($full_name); ?>
                                    </div>
                                </div>

                                <div class="form-control-group">
                                    <div class="control-group">
                                        <?php echo form_input($password); ?>
                                    </div>
                                </div>
                                <div class="control-group">
                                    <ul class="clearfix">
                                        <li class="pull-left">
                                            <input type="radio"  name="gender" value="Male" id="male" required />
                                            <label for="male" class="custom-radio-label">Male</label>
                                        </li>
                                        <li class="pull-left">
                                            <input type="radio" name="gender" value="Female" id="female" />
                                            <label for="female" class="custom-radio-label">Female</label>
                                        </li>
                                    </ul>
                                </div>
                                <!--<div class="server-side-error">
                                    You have signed up via Facebook, please log in with Facebook
                                </div>-->
                            </div>
                        </div>

                    <!--
                    FOOTER
                    ========================================================= -->
                        <div class="footer">
                            <div class="clearfix">
                                <div class="pull-right">
                                    <button type="reset" class="action">cancel</button>
                                    <button type="submit" id="signup_submit" name="submit" class="event">sign up</button>
                                </div>
                            </div>
                        </div>
                    </div>
                    <?php echo form_close(); ?>
                </div>

现在点击注册,我需要根据id =“second”重定向到此表单。

我需要在满足我的验证部分后重定向它。

以下是我对注册表单的验证,该表单只有一个emailid文本。

$("#form-register #emailid").blur(function() {
                            if (validFunction($(this))) {
                                $('#server-side-error').html=('<li><div class="server-side-error">You are a registered user , please login.</div></li>');
                                var user_emailid=$(this).val();
                                $.post('<?php echo BASE_URL; ?>complaint/emailUnique', {email: $(this).val()}, function(data) {
                                data = $.trim(data);
                                if ((data != "register") && (data != "Facebook")) {
                                    failCall($("#form-register #emailid"), 'You are not a registered user, please signup');
                                    window.location.href="#signUpSecondary"; // i need to redirect here

                                } else if((data == "register")) {
                                    $('#server-side-error').html('<li><div class="server-side-error">You are a registered user , please login.</div></li>');
                                } else {
                                    return successCall($("#form-register #emailid"));
                                }
                            });
                        }
                    });
任何人都可以帮助我。 感谢。

1 个答案:

答案 0 :(得分:0)

这能解决你的问题吗?

<a href="#second"> signup </a>