Hi community, I’ve a problem and I searched everywhere and have not found information about this, I use Yii2 and i want load views from another o same controller but via ajax. I use the gii generator CRUD for the developement of MVC but for example, I do not want thah the apliaction reload the page for load a new view.
Did you try to render another controller’s view in the action like below?
$this->render(’//absolutne/path/to/theview/file’);
If I understand you right - you should add a ‘data-pjax’ attribute to your links like below:
<?= \yii\helpers\Html::a(Yii::t('app', 'NEW PAGE'), ['car/view', 'id' => $car->id], ['data-pjax'=>0]) ?>
also check out this articles:
Pjax on ActiveForm and GridView - Yii2
http://www.yiiframework.com/wiki/772/pjax-on-activeform-and-gridview-yii2/
How to use GridView with AJAX
http://git.yiisoft.com/wiki/655/how-to-use-gridview-with-ajax/