/** * Delete a single person based on the ID * * URI: /delete * */ public function delete() { if ($this->request->getParameter('csrf') === $this->csrf->getCurrentToken()) { try { $this->people->deleteById((int) $this->request->getParameter('id')); $message = 'success'; $response = 200; } catch (\Exception $e) { $message = 'failure'; $response = 500; } } else { $message = 'failure'; $response = 500; } $template_vars = array('json' => json_encode(array('message' => $message))); $html = $this->renderer->render('page/data.php', $template_vars); $this->response->setStatusCode($response); $this->response->setContent($html); }