Hello Guys,
I’m trying to use Pjax for the ajax stuff in my project.
For simplicity, my goal is to update the div #aboutdiv with the content of site/about.
My code:
views\site\index.php
...
<div id="aboutdiv"></div>
<?php Pjax::begin() ?>
<?= Html::a(
'about',
Url::to(['site/about']),
['data-pjax'=> '#aboutdiv']
) ?>
<?php Pjax::end(); ?>
...
controllers\SiteController.php
...
public function actionAbout()
{
if (Yii::$app->request->isPjax) {
return $this->renderPartial('about');
} else {
return $this->render('about');
}
}
It’s not working. My link acts like a normal link, no ajax requests, etc.
What am I doing wrong?
Thank you guys, for this amazing framework.