public function action_delete() { $post = Validate::factory($_POST)->rule('pit', 'not_empty')->rule('user', 'not_empty'); $success = 1; $msg = ""; if ($post->check()) { $task = new Model_Task(); $task->del($post); $msg = "Tarefa removida com sucesso."; } else { $success = 0; $msg = "Erro ao deletar tarefa."; } $this->request->headers['Content-Type'] = 'application/json'; $this->request->response = my_json_encode(array('success' => $success, 'msg' => $msg, 'content' => $_POST)); }