$(function () { $("#form-street-edit").validate({ rules:{ location:{ maxlength:128 }, contact: { maxlength:64 }, phone: { isMobile:true }, email: { isEmail:true, maxlength:64 } }, onkeyup:false, focusCleanup:true, success:"valid", submitHandler:function(form){ $(form).ajaxSubmit({ type: 'post', url: pagePath+"/street/streetInfo/update", dataType:"json", success: function(data){ if (data.success) { succeedMessage(data.message); }else { // $(form).find(":submit").attr("disabled", false); errorMessage(data.message); } } }); return false; // 非常重要,如果是false,则表明是不跳转,在本页上处理,也就是ajax,如果是非false,则传统的form跳转。 }, errorPlacement: function(error, element) { if(element.attr('id') == 'rest_area'){ error.addClass(' label_error') } error.appendTo(element.parent()); } }); });