/** * Get and return next comments bach * * @param string $postId * @return string */ public function getComments($postId = '') { try { //Return Json Data echo json_encode(['error' => false, 'comments' => $this->load->view('partials/_comments-grid', ['comments' => $this->postRepo->paginateComments($this->postRepo->getPost($postId))], true)]); } catch (Exception $e) { //Unexpected error echo json_encode(['error' => true, 'message' => $e->getMessage()]); } }