/* AJAX CODE */
$.ajax({
type: "POST",
data: {'data':{
'User':{
'email': email,
'password': password
}
}},
url: baseUrl+"/users/login",
success: function(result) {
}
});
/* users_controller.php */
function login() {
if($this->RequestHandler->isAjax() == true) {
if ($this->Session->check('Auth.User')) {
} else {
echo json_encode
($this->
data);
}
$this->render(null,'ajax');
}
function beforeFilter() {
parent::beforeFilter();
$this->
Auth->
fields =
array('username' =>
'email',
'password' =>
'password');
}