[CakePHP]: Ajax paging in cakephp

PHP CAKE PHP

Posted on 2014-12-10 02:33:25


Controller:

var $components = array('RequestHandler');
 
function index()
{
    if($this->RequestHandler->isAjax())
    {
        $this->viewPath = 'elements'.DS.'portfolio';
        $this->render('boughtsold_table');
    }
}

View

<?php if(!empty($ajax)) echo $javascript->link('prototype');?>
 
<div id="LoadingDiv" style="display: none;">
    <?php echo $html->image('ajax-loader.gif'); ?>             
</div>
 
<div id="boughtsold">   
    <?php echo $this->element('portfolio/boughtsold_table'); ?>
</div>
 
 
<?php
    $paginator->options(array('update'=>'boughtsold', 
	'url'=>array('controller'=>'Portfolios', 'action'=>'index'), 
	'indicator' => 'LoadingDiv'));
?>