jQuery validation and problem with it to CodeIgniter

Hello
I want to write an jQuery validation data (database) for username and password and captcha with CodeIgniter!
The problem is not working properly js code.

Please see the code and help me:

class Login extends CI_Controller {
    function __construct()
	{
		parent::__construct();                
	}
    function index()
    {	
	//************** create captcha **************//
	$vals = array(
	    'img_path'	 => './captcha/',
	    'img_url'	 => 'captcha/',
	);
	$cap = create_captcha($vals);
	$cap['cap'] = $cap;
	$data = array(
	'captcha_time'	=> $cap['time'],
	'ip_address'	=> $this->input->ip_address(),
	'word'	 => $cap['word']
	);
	$query = $this->db->insert_string('captcha', $data);
	$this->db->query($query);
	
	if($this->session->userdata('login') || $this->session->userdata('logged'))
        {
	//************** check validation **************//
	$useradmin = $this->input->post('useradmin');
	$passadmin = $this->input->post('passadmin');
	$capcher_code = $this->input->post('capcher_code');
	
	// validation useradmin //
	$query = $this->db->get_where('login', array('useradmin' => $useradmin));
	if ($query->num_rows()>0) {
	    $user_query = 'true';
	} else {
	    $user_query = 'false';
	    $EROR = "TRUE";
	}
	// validation passadmin //
	$query = $this->db->get_where('login', array('passadmin' => $passadmin));
	if ($query->num_rows()>0) {
	    $pass_query = 'true';
	} else {
	    $pass_query = 'false';
	    $EROR = "TRUE";
	}
	
	// validation captcha //
	// First, delete old captchas
	$expiration = time()-7200; // Two hour limit
	$this->db->query("DELETE FROM captcha WHERE captcha_time < ".$expiration);	
	
	// Then see if a captcha exists:
	$sql = "SELECT COUNT(*) AS count FROM captcha WHERE word = ? AND ip_address = ? AND captcha_time > ?";
	$binds = array($capcher_code, $this->input->ip_address(), $expiration);
	$row = $this->db->query($sql, $binds)->row();
	
	if ($row->count == 0){
	    $captcha_query = 'false';
	    $EROR = "TRUE";	    
	} else {
	    $captcha_query = 'true';
	}
	return json_encode($user_query.$pass_query.$captcha_query);
	
	//************** Login to admin **************//                
            //If succses fulll fild
            if($this->login_model->check_id($this->input->post('useradmin'), $this->input->post('passadmin')))
            {
                $data = array('login' => $this->input->post('useradmin'), 'logged'=>true);
                $this->session->set_userdata($data);
                redirect('admin/adminindex');
            }
            else
	    {
                $data['error'] = 'conpet';
                $this->load->view('admin/login', $data, $cap);
            }
        }
        else {
             //what load error filde
             $this->load->view('admin/login', $cap);
        }
    }
}

and jQuery:

$("#login_submit").click(function (event) {
        event.preventDefault();
        var username = $("#input_username").val();
        var password = $("#input_password").val();
        var capcher = $("#input_code").val();
        var dataString = 'useradmin=' + username + 'passadmin=' + password + 'capcher_code=' + capcher;
        $.ajax({
            type: "POST",
            url: "/co/login",
            data: dataString,
            cache: false,
            dataType: "json",
            success: function (data) {
                if (data[0] == 1) {
                    $('#Result_user').empty().append('<div class="novalid_login"></div>');
                    $Eror = "TRUE";
                } else {
                    $('#Result_user').empty().append('<div class="valid_login"></div>');
                }
                //*Eror Password
                if (data[1] == 1) {
                    $('#Result_pass').empty().append('<div class="novalid_login"></div>');
                    $Eror = "TRUE";
                } else {
                    $('#Result_pass').empty().append('<div class="valid_login"></div>');
                }
                //*Eror Captcha
                if (data[2] == 1) {
                    $('#Result_captcha').empty().append('<div class="novalid_login"></div>');
                    $Eror = "TRUE";
                } else {
                    $('#Result_captcha').empty().append('<div class="valid_login"></div>');
                }
                if ($Eror == "FALSE") {
                    location.href = 'admin/login'
                }
            }
        });
        return false;
    });
                if ($Eror == "FALSE") {

You never assign “FALSE” to this variable, so it is undefined, not false, when none of the conditionals make it “TRUE”.

Don’t confuse PHP and JavaScript, either. Don’t start your JavaScript variable names with a dollar sign.