更新时间:2023-02-07 14:14:52
在您的控制器中执行此操作
In your controller do this
if (Yii::app()->request->isAjaxRequest) {
$done =$this->renderPartial('index', array('dataProvider' =>
$dataProvider), true);
echo $done;
Yii::app()->end();
}
并将您的ajax调用更改为此
And change your ajax call to this
$.ajax({
url: 'index.php/news',
type: "POST",
dataType: "html",
success: function(data){
$('#news').html(data);
}
})