how to receive response from ajax call with sencha touch from codeigniter / ExtJS
i am trying to get a response from codeigniter when I send my ajax request from sencha touch/ Ext with
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);
//...
and in codeigniter something like
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);
}
and the view
<?php
echo 'username: '.$username;
?>
i allways get the Error "Login Failed" and the response of the POST is allways empty (while parameters are send correctly)
any ideas? THNX!!!
精彩评论