$("form").validate({
onfocusout: function(element){
$(element).valid();
},
rules: {
'username': {
required: true,
},
password: {
required: true,
},
verify: {
required: true,
},
},
messages: {
username: {
required: "请输入用户名",
},
password: {
required: "请输入密码",
},
verify: {
required: "请输入验证码",
},
},
errorPlacement: function(error, element) {
//错误信息显示到最后面
$('.erro_tip').show();
error.appendTo(element.parents('li').children('.erro_tip'));
},
submitHandler: function(form) {
var self = $(form);
$.post(self.attr("action"), self.serialize(), success, "json");
return false;
function success(data) {
if(data.status) {
window.location.href = data.url;
} else {
self.find(".Validform_checktip").text(data.info);
//刷新验证码
$(".reloadverify").click();
}
}
}
});