How thinkphp5 parses imported external resource files
滿天的星座
滿天的星座 2017-05-27 17:44:00
0
1
888

I wrote a lot of js code in the
template file, and now I want to transfer them to external resource files
But the ajax path inside needs to be parsed by thinkphp5
For example:

 $.ajax("{:url('home/index')}")

If I transfer it directly, the url will not be parsed.
How to solve this problem?
Also,
will external text be faster than js written directly on the html page?

滿天的星座
滿天的星座

reply all(1)
为情所困

I have two solutions.
One is global variables, which are declared directly in the header template and the footer loads external files.
The other is to encapsulate most operations in closures and then call them directly in the footer!

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template