美文网首页
2018-08-21

2018-08-21

作者: 漏诺 | 来源:发表于2018-08-21 10:17 被阅读6次

判断手机号重复的内容

       2018.8.21

html页面样式

html页面js               

//去除字符串中所有空格

function removeAllSpace(str) {

       return str.replace(/\s+/g, "");

}

//表单提交,录入重复手机号信息判断,客户来源信息必须填写判断

 $(function () {

            $(".submitBtnA").click(function () {

                var aa=removeAllSpace($("#tel_iris").val());

                //alert(bb);return;

                $.post('/manage/custom/judgeTel',{tel:aa}, function(res){

                    if(aa == 0){

//document.getElementById("tel_iris").value = "暂无";

//如果手机号为空,默认为暂无

alert("电话必填!如果没有电话?填写微信!");return;

                    }else if(res.length > 0){

alert('该电话号已存在,请重新录入!');return;

                    }else if($("#customer_source_add").val() == 0){

alert("请选择客户来源!");return;

                    }else{

                         $("#AddForm").submit();

                    }

                });

            });

});

控制层中获取手机号的方法

public function judgeTel(){

        $tel = trim($_POST['tel']);

        $res = M("Custom")->field("id,tel")->where("tel like '%{$tel}%'")->select();

        $this->ajaxReturn($res);

}

相关文章

网友评论

      本文标题:2018-08-21

      本文链接:https://www.haomeiwen.com/subject/pujdiftx.html