我想使用验证引擎进行现有电子邮件检查。但在 firebug 控制台中显示如下问题:
遇到 PHP 错误严重性:通知
消息:未定义索引:reg_em
文件名:控制器/user.php
行号:170
[“电子邮件”,真]
Ajax 错误:200 解析器错误
这是我的 jquery.validationEngine-en.js:
"ajaxCheckEmail": {
"url": base_url+"user/checkEmailExistence/",
"extraDataDynamic": ['#reg_em'],
"alertTextOk": "* This email is available",
"alertText": "* This email is already taken",
"alertTextLoad": "* Validating, please wait"
},
电子邮件字段视图:
<input type="text" class="text_item_val_style validate[required,ajax[ajaxCheckEmail],custom[email]]" name="useremail" id="reg_em" style="height:21px;"/>
控制器:
函数 checkEmailExistence(){
$email = $_REQUEST['reg_em'];
$getStatus = $this->users->existing_email_check($email);
echo $getStatus;
}
模型:
function existing_email_check($email){
$valid = true;
$rs = $this->db->where('email', $email)->get('users');
if($rs->num_rows() > 0){
$valid = false;
}
$rs->free_result();
$arr = array('email',$valid);
return json_encode($arr);
}