ajax帖子的问题

时间:2010-03-14 21:33:28

标签: jquery

由于一些奇怪的原因,下面的代码首先工作,然后网站重定向到网址。我以前多次使用过此代码没有任何问题,请指教!

<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">
                                <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>

2 个答案:

答案 0 :(得分:3)

也许你应该在提交按钮的点击事件中返回false。

或者您可以尝试将type =“submit”更改为type =“button”

答案 1 :(得分:0)

您错过了参数:contentTypedataType