ITeye博客

jquery异步校验

kasuqi · 2010-10-26 14:44 · JQuery · Web前端 · Markdown

        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,再做相应的处理

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。