日期:2014-05-17 浏览次数:20835 次
<tr> <td width="20%" align="right"> 帐号: </td> <td style="width:205px;"> <input type="text" value="" name="users.loginName" class="inputcss" datatype="s6-18" ajaxurl="<%=basePath %>login/checkUserExist.action" nullmsg="请输入用户名!" errormsg="帐号至少6个字符,最多18个字符,只能是数字字母下划线!" /> </td>[code=Java]
$(".addUserform:eq(0)").Validform({ tiptype:2, ajaxPost:true, callback:function(s){ //返回数据data是json格式,{"info":"demo info","status":"y"} //info: 输出提示信息; //status: 返回提交数据的状态,是否提交成功。如可以用"y"表示提交成功,"n"表示提交失败,在ajax_post.php文件返回数据里自定字符,主要用在callback函数里根据该值执行相应的回调操作; //你也可以在ajax_post.php文件返回更多信息在这里获取,进行相应操作; //这里执行回调操作; var data = eval(s); if(data.status=="y"){ setTimeout(function(){ $.Hidemsg(); //公用方法关闭信息提示框; },2000); } } });
if($(this).attr("ajaxurl")){ var inputobj=$(this); inputobj.attr("valid",tipmsg.c); $.fn.Validform.sn.showmsg(tipmsg.c,settings.tiptype,{obj:inputobj,type:1,sweep:settings.tipSweep},"hide"); $.ajax({ type: "POST", url: inputobj.attr("ajaxurl"), data: "param="+$(this).val()+"&name="+$(this).attr("name"), dataType: "text", success: function(s){ if(s=="y"){ inputobj.attr("valid","true"); errorobj=null; $.fn.Validform.sn.showmsg(tipmsg.r,settings.tiptype,{obj:inputobj,type:2,sweep:settings.tipSweep},"hide"); }else{ inputobj.attr("valid",s); errorobj=inputobj; $.fn.Validform.sn.showmsg(s,settings.tiptype,{obj:inputobj,sweep:settings.tipSweep}); } }, error: function(){ inputobj.attr("valid",tipmsg.err); errorobj=inputobj; $.fn.Validform.sn.showmsg(tipmsg.err,settings.tiptype,{obj:inputobj,sweep:settings.tipSweep}); } });