开发者

problem with ajax post

开发者 https://www.devze.com 2022-12-23 09:33 出处:网络
For some weird reason, the codes below are first working, then website is redirecting to the url. I used this code many times before without any problems, please please advise!

For some weird reason, the codes below are first working, then website is redirecting to the url. I used this code many times before without any problems, please please advise!

<script type="text/javascript">
    $(document).ready(function() { 
        $("[name='submit']").click(function() { 
            $.ajax({
                type: "POST",
                data: $(".form-signup").serialize(),
                url: "ss=Add2Member", 
                success: function(output) { 
                $('.form-signup').html(output)
                },
                error: function(output) {
                $('.form-signup').html(output);
                }
            }); 
    }); 
    }); 
    </script> 
                        <form method="post" action="http://www.refinethetaste.com/FLPM/content/myaccount/signup.cs.asp?Process=Add2Member" class="form-signup">
                        <div class="clearfix">
                            <label for="MembersFullName">Full Name *:</label>
                            <div class="username form-height">
                                <input id="modlgn_username" type="text" name="MembersFullName" value="" class="inputbox" size="18" />
                            </div>

                            <label for="MembersEmailAddress">Email Address *:</label>
                            <div class="username form-height">
                                <input id="modlgn_username" type="text" name="MembersEmailAddress" value=""  class="inputbox" size="18" />
                            </div>
                            <label for="MembersPassword">Password *:</label>
                            <div class="password  form-height">
                                <input id="modlgn_passwd" type="password" name="MembersPassword" class="inputbox" size="18" />
                                </div>

                            <label for="MembersPasswordc">Password (confirm) *:</label>
                            <div class="password  form-height"&g开发者_运维技巧t;
                                <input id="modlgn_passwd" type="password" name="MembersPasswordc" class="inputbox" size="18" />
                                </div>
                            <div id="inputs">
                                <input type="checkbox" name="agree"  class="checkbox" value="1" />
                                <label for="agree" class="agree">I agree to User Agreement and Privacy Policy.</label>
                            </div>

                            <div class="clear">
                                <input type="submit" name="submit" class="button-login png" value="Sign Up" />
                            </div>
                        </div>
                        <div id="form-login-remember"> 
                            <div class="form-indent-top">
                                <span class="login-text-1">Already Have Account?</span>
                                <a href="?Section=myaccount&SubSection=signin"> Sign In</a>

                                </div>
                        </div>
                        </form>


Perhaps you should return false at the click event of the submit button.

Or you could try and change the type="submit" to type="button"


You missed parameters: contentType and dataType

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号