Causes analysis of Yii2 inline script loading failure using Pjax in Yii2 _php instance

Source: Internet
Author: User

An error occurred when I loaded the Yii2 activeform with Defunkt/jquery-pjax, which is normally

ActiveForm Two JS should be loaded first, and the actual situation is

Typeerror:jquery (...). Yiiactiveform is not a function.

The problem has been discussed and resolved in the GitHub issues.

Pjax first executes the inline <script> via HTML (), and then executes the <SCRIPT> with SRC by executescripttags (), causing Yiiactiveform to be found. The Pjax author refuses to use Jquery.getscript () to resolve this problem because the security reason function uses eval to not conform to the CSP (Content secure Policy)

The above describes the use of Pjax in Yii2 to cause Yii2 inline script loading failure of the reasons for the analysis of the relevant information, I hope that the above help!

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.