jqueryFormvalidator Ajax添加數據驗證是否存在

 

          
  
  
           
  
  
  1. $(function(){ 
  2.                 $.formValidator.initConfig({formid:"myform",autotip:true});  
  3.                  
  4.                 $("#name").formValidator({onshow:"請輸入客戶分類名稱",onfocus:"2到20個字符"}).inputValidator({min:2,max:20,onerror:"2到20個字符"}).ajaxValidator({ 
  5.               dataType : "html"
  6.               async : true
  7.               url : "${pageContext.request.contextPath}/clientSortSTManage/clientSortST!isEqualClientSortName.action"
  8.               success : function(data){ 
  9.                   if(data=='true'){ 
  10.                       return true
  11.                   } 
  12.                   else
  13.                       return false
  14.                   } 
  15.                      
  16.               }, 
  17.               buttons: $("#submit"), 
  18.                     error: function(jqXHR, textStatus, errorThrown){alert("服務器沒有返回數據,可能服務器忙,請重試"+errorThrown);}, 
  19.               onerror : "該客戶分類名稱已存在,請更換客戶分類名稱"
  20.               onwait : "正在對客戶分類名稱進行合法性校驗,請稍候..." 
  21.           }); 
  22.            
  23.            
  24. }) 
 
          
          
}
相關文章
相關標籤/搜索