1
這是我的代碼isAjax()在CakePHP 2.0上已被棄用。用什麼方法替代那個方法?
function add() {
if(!empty($this->data)) {
if($this->Post->save($this->data)) {
if($this->RequestHandler->isAjax()){ //isAjax method is deprecated.
//Handle Ajax
$this->render('notif','ajax');
} else {
$this->Session->setFlash('Add successfully');
$this->redirect(array('action'=>'index'));
}
}
else {
$this->Session->setFlash('Add failded please try again');
}
}
}
在這裏,我讀到方法已http://book.cakephp.org/2.0/en/appendices/2-0-migration-guide.html?highlight=isajax
如何解決呢?