Error how to remove it?
jQuery(...).yiiActiveForm is not a function I use Pjax and need to change jQuery version, for this I disable the default version:
'bundles' => [ 'yii\web\JqueryAsset' => false, //отключаем генерацию по умолчанию JQuery ], I connect jQuery in layouts :
<script type="text/javascript" src="/basic/web/assets/build/js/js_min/lib/Jquery/jquery-2.2.2.min.js"></script> I tried to connect via AssetBundle and $this->registerJsFile('url/to/file.js', ['position' => yii\web\View::POS_HEAD]);
Everything works fine until I switch to the view module. But layout main is one common to the whole application.
If you still connect the module's View :
<script type="text/javascript" src="/basic/web/assets/build/js/js_min/lib/Jquery/jquery-2.2.2.min.js"></script> But all the scripts will work. But that error still arises.
It seems that there is no such thing in Yii2 2.5 , but there is one in the new one.
Application / Experiments / Reports
1. Attempt, trying to add ( negative result )
'components' => [ 'assetManager' => [ 'class' => 'yii\web\AssetManager', 'appendTimestamp' => true, //Включаем поддержку версионности 'bundles' => [ 'yii\web\JqueryAsset' => [ 'sourcePath' => null, // do not publish the bundle 'js' => [ 'http://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js', ] ], ], 'linkAssets' => false, //генерация прямых ссылок на файлы, без копирование ресурсов ], ], 2. Attempt ( positive result )
Archive of our application:
1. Our application has one module that does not have its own layout, and by default all its views will be displayed in the base layout of the application itself (I have it main.php).
2. We use JQueryPjax, not the Pjax that is installed in Yii2 by duolt.
3.Connecting jQuery, we do in layout main.php, at the very bottom
<div class="wrap"> <div id="pjax-container"> <?= $content ?> </div> </div> <script type="text/javascript" src="/basic/web/assets/build/js/js_min/lib/Jquery/jquery-2.2.2.min.js"></script> <script type="text/javascript" src="/basic/web/assets/build/js/js_min/lib/Pjax/jquery.pjax-min.js"></script> <?php $this->endBody() ?> </body> </html> <?php $this->endPage() ?> 4.If we remove the css class wrap , then again there will be an error when we go into the View module. If we do not remove this class, then there will be no error. Why?
New data
CSS class has nothing to do with it! Only the div plays the role. That is, if it does not exist, there will be an error. Why?