|
发表于 2011-8-30 17:46:31
|
显示全部楼层
controllers:
function check_name()
{
$qs = query_string_to_array();
$name = $qs['tbxRegisterNickname'];
$this->load->model('customer_model');
$msg = array('Result' => true);
if ($name){
if ($this->customer_model->check_name($name)){
$msg = array('Result' => false);
}
}
echo json_encode($msg);
}
view:
$("#tbxRegisterNickname")
.ajaxValidator(
{
type: "GET",
url: '<?php echo site_url('login/check_name')?>',
datatype: "json",
success:
function(result)
{
return result.Result;
},
buttons: $("#ibtRegister"),
onwait: "正在检测用户名是否重复...",
onerror: "该用户名已被使用"
});
<div class="lo_child">
用户名:<input name="tbxRegisterNickname" maxlength="20" id="tbxRegisterNickname" type="text">
</div>
希望对你有帮助
|
|