CodeIgniter Forums
Problem with extjs and codeigniter - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Problem with extjs and codeigniter (/showthread.php?tid=1991)



Problem with extjs and codeigniter - El Forum - 07-10-2007

[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


Problem with extjs and codeigniter - El Forum - 07-10-2007

[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


Problem with extjs and codeigniter - El Forum - 07-10-2007

[eluser]Unknown[/eluser]
Thanks CI Mirage