标签:console city asc mit code form save class url
jQuery Validate Ajax 验证
<script type="text/javascript"> $(function() { $(‘#formCityLink‘).validate({ rules : { link : "required" }, messages : { link : "请输入链接" }, invalidHandler : function(){ console.log(‘in invalidehandler‘); return false; }, submitHandler : function(){ console.log(‘in submithandler‘); var url = ‘city_link/create.do‘; $.getJSON(url,{ link:$(‘#link‘).val() },function(data){ alert(data.res) }); return false; } }); $(‘#btnSaveLink‘).click(function(){ $(‘#formCityLink‘).submit(); }); });
之前在button的click事件中进行ajax请求,现在修改在validate中进行ajax请求;
标签:console city asc mit code form save class url
原文地址:http://www.cnblogs.com/stono/p/6616645.html