作者:皮蓬 | 来源:互联网 | 2023-08-29 20:47
js代码
1 2 3 4 5 6
| $(".pagination a").on('click',function(){
$.post($(this).attr('href'),function(data){
console.log(data);
})
return false;
}) |
控制器代码
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| public function actionIndex() {
$model = new Dish();
$where['status'] = 1;
$info = $model->getPageList($where, 10, 'dishid desc');
if(Yii::$app->request->isAjax){
return $this->render('more',[
'list' => $info['list'],
]);
}else{
return $this->render('index',[
'list' => $info['list'],
'page' => $info['page'],
]);
}
} |
在运行的时候出现400 错误 在控制器内应该怎么写啊!