Home > Backend Development > PHP Tutorial > Using Pjax in Yii2 causes the Yii2 inline script to fail to load, yii2pjax_PHP tutorial

Using Pjax in Yii2 causes the Yii2 inline script to fail to load, yii2pjax_PHP tutorial

WBOY
Release: 2016-07-12 08:57:45
Original
772 people have browsed it

Using Pjax in Yii2 causes the problem of Yii2 inline script loading failure, yii2pjax

 When I use defunkt/jquery-pjaxAn error occurred when loading <strong>ActiveForm</strong> of Yii2, normally it is

The two js of

<strong>ActiveForm</strong> should be loaded first, but the actual situation is

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

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

 Pjax first executes the inline <script> through html()</span></span>, and then executes the tag through executeScriptTags() <script> with src, so </script>yiiActiveForm cannot be found. The Pjax author refuses to use JQuery.getScript() to solve this problem because the use of eval in the function does not comply with CSP (Content Security Policy) for security reasons

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

Personal test showed no problem.

Ah

’s

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1106270.htmlTechArticleUsing Pjax in Yii2 causes the problem of Yii2 inline script loading failure, yii2pjax When I use defunkt/jquery- An error occurred when pjax loaded Yii2's ActiveForm. Normally it is ActiveF...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template