Yii is not auto including jquery

后端 未结 2 1439
梦毁少年i
梦毁少年i 2021-02-15 19:15

I have a strange problem with Yii & Jquery:

When I open a page which uses ajax/jquery on localhost Yii does automatically add asset include calls to the of the pag

2条回答
  •  甜味超标
    2021-02-15 19:58

    It seems like you're not registering jQuery in the correct way. You must add the following line in /protected/views/layout/main.php before tag:

    clientScript->registerCoreScript('jquery'); ?>
    

    It will load jQuery automatically. Remember, if the YII_DEBUG flag is on it will load non-minified version, when deactivated (on production) it will load minified version. Hope this will fix your problem.

提交回复
热议问题