Using Pjax in Yii2 causes the Yii2 inline Script Loading failure, yii2pjax

Source: Internet
Author: User

Using Pjax in Yii2 causes the Yii2 inline Script Loading failure, yii2pjax

When I use defunkt/jquery-pjax to load the Yii2ActiveFormAn error occurred. Normally, it is

ActiveFormThe two js files of are loaded first, but the actual situation is:

TypeError: JQuery (...). yiiActiveForm is not a function.

This issue has been discussed and resolved in issues on github.

Pjax first executes the inline <script> through html () and then executes the <script> with src through executeScriptTags (), so the yiiActiveForm cannot be found. Pjax authors refuse to use JQuery. getScript () to solve this problem, because the function uses eval for Security reasons and does not comply with the CSP (Content Security Policy)

One participant in Yii2 modified Pjax so that Pjax can work well in Yii2 hiqdev/jquery-pjax

No problem during the test.

Ah

 

 

 

 

 

Of

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.