$ ("#commentForm"). Validate (): On it, what parameters should be added ...
Registration information authentication text message $ (function () {JQuery.validator.addMethod ("IsMobile", function (value, Element) {var length = Val
Ue.length; return this.optional (Element) | | (length = &&/^ ((13[0-9]{1}) | ( 15[0-9]{1}) | (18[0-9]{1}))
+\D{8}) $/.test (value)); "Please fill in your phone number correctly."
"); Entry into force $ ("#signup-form"). Validate ({//validation rules: {userName: {required: True, Minlength:3}, Mobile: {required:true, is
Mobile:true}, Password: {required:true, Minlength:3, MAXLENGTH:20}, Passwordconfirm: {required:true, Minle
Ngth:3, maxlength:20, Equalto: ' #password '}},//completed content validation
Messages: {userName: {required: ' Please enter login name ' }, Mobile: {required: ' Please input mobile phone number ', email: ' Please enter the correct phone number '}, Password: {required: ' Please enter password '}, Passwordconfirm: {required:
' Enter password again ', Equalto: ' Please enter the same password '}}, Errorplacement:function (error, Element) {
Error.insertafter (Element.parent ());
}, Submithandler:function () {var userName = $ ("Input[name=username]"). Val ();
var password = $ ("Input[name=password]"). Val ();
var mobile = $ ("Input[name=mobile]"). Val ();
Password = $.md5 (password); $.ajax ({type: POST), url: "/system/register", ContentType: "Application /json; Charset=utf-8 ", DataType:" JSON ", headers: {Accept:" Application/json "}, Data:JSON.stringify ({username:username, Password:password, mobile:mobile}), Success:function (data) {if (
Data.code = = 0) {alert ("registered successfully");
Window.location.href= "/system/home";
else {alert (data.msg);
}
}
});
}
});
});
Http://jqueryvalidation.org/documentation http://www.runoob.com/jquery/jquery-plugin-validate.html