我想加載上通過AJAX在這裏我的觀點的項目清單是我在lst.cpt代碼加載視圖
<div id='benpane' class='clearfix'>
<script type="text/javascript">
<?php echo $ajax->remoteFunction(array(
'url'=>array('controller'=>'benefits', 'action'=>'display'),
'update'=>'benpane',
'indicator'=>'benIndicator'
)); ?>
</script>
</div>
這裏是我的控制器善堂功能
function lst() {
$this->paginate = array('order' => array('ben_name' => 'ASC'),'conditions' => array($this->Benefit->parseCriteria($this->passedArgs)));
$benefit = $this->paginate('Benefit');
$this->set('bens', $benefit);
}
當我嘗試打開查看我得到的錯誤
Error: Call to a member function remoteFunction() on a non-object
File: /var/www/hassportal/app/View/Benefits/lst.ctp
Line: 14
什麼可能我是做錯了什麼?
你不應該使用JSHelper呢? –