搜索谷歌和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
}
});
答案 0 :(得分: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);
}
});
}
});
});