`
kasuqi
  • 浏览: 12566 次
  • 性别: Icon_minigender_1
  • 来自: 湖南
社区版块
存档分类
最新评论

jquery异步校验

阅读更多
        var phone = getphone();
        $.post("${ctx}/dataManage/qryisExitPhone.action", {
            "phone" : phone
            ,"hiphone" : hiphone
        }, function(date) {
            if (date == 'true') {
                //alert("电话号码已经存在,请重新输入");
                $("#telerror").text("电话号码已经存在,请重新输入").css("color","red").show();
            }else
            {
                //此处用的是猫冬的校验框架
                if(jQuery.formValidator.pageIsValid('1')){
                    document.costumeForm.action = "updSmData.action?retablerID=" + id+"&memID="+mID;
                    document.costumeForm.submit();
                }
            }
        });
 

简要说明

.post语法格式  :jQuery.post(url, [data] , [callback] , [type] )

  1.调用一个时间执行此处的代码

  2.url:   "${ctx}/dataManage/qryisExitPhone.action"

  3.[date]:   "phone" : phone ,"hiphone" : hiphone

  4.[callback] function(date)  date为action层打印给页面的字符串

  getPrintWriter().print(flag);  //flag为true或false

  再判断date,再做相应的处理

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics