Yii is not auto including jquery

后端 未结 2 1438
梦毁少年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 </head> tag:

    <?php Yii::app()->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.

    0 讨论(0)
  • 2021-02-15 19:58

    If all is working on your local machine it might be a permission problems

    Have you checked that /assets is writable on your server ?

    Yii publishes the assets it needs at runtime in this directory

    0 讨论(0)
提交回复
热议问题