Skip to main content

Posts

Showing posts with the label Cakephp Ajax Pagination

Cakephp Ajax Pagination

Cakephp Ajax Pagination Cakephp Ajax pagination works same like normal pagination , the difference is that it load the pages without refreshing Controller index function public function index(){         $this->paginate = array('limit'=>5,'order'=>'User.id desc');   $userDetail = $this->paginate('User'); $this->set('userDetail',$userDetail); if($this->RequestHandler->isAjax()){ // check the type of request $this->layout = ''; $this->autoRender = false; $this->render('index');  // render the same view } } User index view // script to load page by ajax <script> $(document).ready(function(){ $(".pagination a, .header a").on('click',function(){ $('#content').load(unescape($(this).attr("href")),function(){ }); return false;   }); }); </script> <div id="content"> // show the ...