[eluser]sanks[/eluser]
I fixed it. Instead of returning the value in check() function of ajax controller I used to echo the value to true or false. Also I used $valid as variable to echo it. So the new code is as follows:
Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class User extends CI_Controller {
function __construct()
{
parent::__construct();
}
function check()
{
$this->load->model('useraccount');
$result = $this->useraccount->check_availability();
if($result)
{
$valid = "true";
}
else
{
$valid = "false";
}
echo $valid;
}
}
?>
I guess the jquery validate plugin seeks the value of $valid variable. I hope this post is useful to someone as I always found imperfect answers on this topic