当我从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 !!!