jQuery的Validate插件
http://www.runoob.com/jquery/jquery-plugin-validate.html
项目中的::
$(function () { $('#createDepartment').validator({// jsvalidator框架 rules: { remote: function (element) {//远程异步加载 return $.ajax({ url: /*[[@{/portal/human/department/valid-department-name.act}]]*/ "#", type: 'post', data: { "departmentname": function () { return $('#name').val(); } }, dataType: 'json' }); } }, fields: { "superior.id": "required;superior.id;", "name": "required;name;remote;", "phone": "required;phone;", "address": "required;address;", "type": "required;type;" } }); });