Tag: 不引人注目

CakePHP和jQuery – 不引人注目的动作

我正试图在CakePHP中删除书签,这是一个不引人注目的动作。 虽然它工作得很好,但我怀疑必须有更好的方法来做到这一点。 有人可以指出我正确的方向吗? function delete($id = null) { $ok = $this->Bookmark->delete($id); if($this->RequestHandler->isAjax()) { $this->autoRender = false; $this->autoLayout = false; $response = array(‘status’ => 0, ‘message’ => ‘Could not delete bookmark’); if($ok) { $response = array(‘status’ => 1, ‘message’ => ‘Bookmark deleted’); } $this->header(‘Content-Type: application/json’); echo json_encode($response); exit(); } // Request isn’t AJAX, redirect. $this->redirect(array(‘action’ => […]