1

在搜索了 google 和 SA 之后,我决定在这里发布这个问题。我已经尝试了我看到的所有解决方案。我检查了括号和逗号。如果有人可以指导哪里错了,这是我的 jQuery

$(document).ready(function(){
    $("#form1").validate({
                debug: false,
                rules: {
                    passwordid:"required",
                    username:"required",
                    password_again :"required",
                    password_again:{
                        equalTo: "#passwordid"
                    },
                    email: {
                        required: true,
                        email: true
                    }
                },
                messages: {
                    email: "Please enter your valid email address.",
                    username: "Please enter your username",
                    passwordid:"Enter Password",
                    password_again:"Please enter the same value",
                },
                submitHandler: function(form) {
                    $.ajax
                        ({
                            type: "POST",
                            url: "new.php",
                            data: dataString,
                            cache: false,
                            success: function(html)
                            {
                                $("#result").html(html);
                            }
                        });
                });//error shown here:missing} after property list
            }
    });
4

1 回答 1

1

你的牙套错了,试试这个。我将倒数第二行 ( }) 与 ( ) 周围的倒数第三行交换了});

$(document).ready(function () {
    $("#form1").validate({
        debug: false,
        rules: {

            passwordid: "required",
            username: "required",
            password_again: "required",
            password_again: {
                equalTo: "#passwordid"
            },
            email: {
                required: true,
                email: true
            }
        },
        messages: {

            email: "Please enter your valid email address.",
            username: "Please enter your username",
            passwordid: "Enter Password",
            password_again: "Please enter the same value",
        },
        submitHandler: function (form) {

            $.ajax({
                type: "POST",
                url: "new.php",
                data: dataString,
                cache: false,
                success: function (html) {
                    $("#result").html(html);
                }
            });
        }
    });
});
于 2013-04-02T11:07:10.360 回答