为什么校验不通过也可以提交
我按照老师说的那么写了之后 但是校验不通过也可以提交数据给后台???那这样怎么行呢
$("#signup").validate({
rules:{
Username:{
required:true,
minlength:2
},
EmailAddress:{
required:true,
email:true
},
Password:{
required:true,
minlength: 6,
maxlength: 18
}
},
messages: {
Username: {
required:"请输入用户名",
minlength:"至少两位"
},
EmailAddress: {
required:"请输入密码",
email:"邮箱格式不对"
},
Password:{
required:true,
minlength: "最少六位",
maxlength: "最多18位"
}
},
submitHandler: function (form) { // for demo
alert('valid form submitted'); // for demo
$("input[id=submit2]").click(function () {
event.preventDefault();
$.post("http://218.192.169.173/taobao/login.php", {
email: $("#EmailAddress1").val(),
password: $("#PassWord").val()
}, function (data, textStatus) {
var username = data.username;
var errnum = data.errno;
alert(username);
},"json");
});
return false; // for demo
}
})
});这是我的js代码