如何使用来自codeigniter / ExtJS的sencha touch从ajax调用接收响应

时间:2011-04-11 13:54:43

标签: codeigniter extjs sencha-touch

当我从sencha touch / Ext发送我的ajax请求

时,我试图从codeigniter获得响应
Ext.Ajax.request({//
      url: formBase.url, //something like 'http://path.to/mobile/Login/ajax_validateLogin',
      success:  function(response, opts) {
                    console.log('Login success!');
                    console.log('data: ' + response.responseText);
                },
      failure:  function(result){
                    console.log('Login Error! ');                   
                },

      method: 'POST',
      params: form.getValues()
});
form = new Ext.form.FormPanel(formBase);
//...

并在codeigniter中使用类似

的内容
function ajax_validateLogin() {

    $username = $this->input->post('username'); 
    $password = $this->input->post('password');
    $data['username'] = 'Arschkarte'; //$username;  
    if($username == "f"){
        $data["success"] = true;
    } else {
        $data["success"] = false;
        $data["errors"]["reason"] = "Login failed. Try again.";
    }
    $this->load->view('mobile/loginMobile', $data);
}

和视图

<?php 
    echo 'username: '.$username;
?>

我总是得到错误“登录失败”,POST的响应总是为空(参数发送正确)

任何想法? 日Thnx !!!

0 个答案:

没有答案