public function actionLoadMores() { // action loadmore //sanitize post value $data = array(); if (isset($_POST["page"])) { $page_number = filter_var($_POST["page"], FILTER_SANITIZE_NUMBER_INT, FILTER_FLAG_STRIP_HIGH); } else { $page_number = 0; } //throw HTTP error if page number is not valid if (!is_numeric($page_number)) { header('HTTP/1.1 500 Invalid page number!'); $this->redirect('/'); } //get current starting point of records $position = $page_number * Params::$coursePerPage; //Limit our results within a specified range. $traineelist = new WCourseTrainee(); $results = $traineelist->getListCourses($position, Params::$coursePerPage); //var_dump($results);die; $data = $this->renderPartial('index', array('traineelist' => $results), true); // var_dump($data);die; echo $data; }