1 $("#form-member-add").validate({ 2 rules:{ 3 username:{ 4 required:true, 5 minlength:2, 6 maxlength:16 7 }, 8 mobile:{ 9 required:true, 10 isMobile:true, 11 }, 12 companyname:{ 13 required:true, 14 minlength:4, 15 maxlength:30 16 } 17 }, 18 onkeyup:false, 19 focusCleanup:true, 20 success:"valid", 21 submitHandler:function(form){ 22 $(form).ajaxSubmit(function(data){ 23 layer.msg(data.msg); 24 setTimeout(function () { 25 location.replace(location.href) 26 }, 2000); 27 }); 28 } 29 });