444683462
V2EX  ›  问与答

nicevalidator 远程问题

  •  
  •   444683462 · Nov 26, 2014 · 2726 views
    This topic created in 4217 days ago, the information mentioned may be changed or developed.
    nicevalidator 远程问题remote
    问题是无论数据是否重复,ajax总是返回没有找到。

    <input data-rule="手机账号:required; remote[__URL__/ajaxPhone/, account];"name="account" id="account" type="text" >

    //下面是控制器,问题应该不在控制器,trim(I('post.account'));替换成具体的号码都能验证。
    //ajax验证手机号码是否存在与重复start
    public function ajaxPhone(){
    if(I("post.account")){

    $m=M('staff');
    $data['staff_biznumber']=session('bizNumber');
    $data['staff_phoneaccount']=trim(I('post.account'));
    $value=$m->where($data)->getField('staff_phoneaccount');
    if($value){
    echo "该手机已经被注册";//"错误消息"
    }else{
    echo "还有问题";//""代表成功
    }
    }
    }
    /*ajax验证手机号码是否存在与重复end*/
    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1548 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 16:43 · PVG 00:43 · LAX 09:43 · JFK 12:43
    ♥ Do have faith in what you're doing.