Welcome Guest, Not a member yet? Register   Sign In
Problem with extjs and codeigniter
#1

[eluser]Unknown[/eluser]
I try to use extjs and codeigniter make a form submit example.But if I type the error username and passwd and then I press the submit button,the firebug occur an error,I do not know how to fix it ,can anynoe help me
this is my code:
Code:
<?php
    class Login extends Controller
    {
        public function __construct()
        {
            parent::Controller();
            $this->load->model('drugdb','use');
            $this->sets        = parse_ini_file("./extends/global.ini");
            $this->local    = parse_ini_file($this->sets['rela'].$this->sets['ini'].__CLASS__.$this->sets['type'],true);
        }
        
        public function index()
        {
            $this->load->library('validation');
            $this->load->helper('form');
            $this->load->helper('cookie');
            $data['title']        = $this->local[__FUNCTION__]['title'];
            $data['error']        = '';
            $data['rootPath']    = $this->local[__CLASS__]['rootPath'];
            $username    = $this->input->post('username');
            $passwd        = $this->input->post('passwd');
            $rules['username']    = 'callback_username_check';
            $this->validation->set_rules($rules);
            if ($this->validation->run()    == false)
            {
                $this->load->view($this->sets['viewPath'].'/'.$this->local[__CLASS__]['viewFloder'].'/'.$this->local[__FUNCTION__]['viewName'],$data);
            }
            else
            {
                set_cookie('username',$username,0);
                set_cookie('logged',true,0);
                redirect('drugindex');
            }
        }
        
        public function username_check($str)
        {
            $passwd        = $this->input->post('passwd');
            $count        = $this->use->get_count('admin',array('username'=>$str,'passwd'=>md5($passwd)));
            if ($count >0)
                return true;
            else
            {
                $this->validation->set_message('username_check','<span class="highlight">login error</span>');
                return false;
            }
        }
    }
?&gt;

psConfusedorry about my english
#2

[eluser]Mirage[/eluser]
I'd say you have a problem with what you're send back to extjs. It's probably not expecting an HTML document but rather some json response which it'll attempt to evaluate. Ergo you see an error.

HTH
#3

[eluser]Unknown[/eluser]
Thanks CI Mirage




Theme © iAndrew 2016 - Forum software by © MyBB