easyui 自定义验证规则 验证用户是否已经存在 远程ajax验证

时间:2024-08-24 14:37:14
easyui远程ajax验证
2014年09月30日 22:29:32 clj198606061111 阅读数:6130 标签: easyui 更多
个人分类: jqueryeasyui 版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.****.net/clj198606061111/article/details/39700715
一、有效方式 //扩展验证方法 $.extend($.fn.validatebox.defaults.rules, { checkSignCode:{//检查验证码 validator: function (value) { var checkR=$.ajax({ async : false, cache : false, type : 'post', url : '../signcode/check', data : { 'signcode' : value } }).responseText; return checkR==="true"; }, message: '验证码错误' } }); 二、无效方式 //扩展验证方法 $.extend($.fn.validatebox.defaults.rules, { checkSignCode:{//检查验证码 validator: function (value) { var checkR=false; $.ajax({ async : false, type : 'post', url : '../signcode/check', data : { 'signcode' : value }, success : function(result) { if (result === 'true') { checkR= true; } } }); return checkR; }, message: '验证码错误' } });