Reputation: 3
I just build a site use PJAX, I have include the jquery.min.js
at the end of template html file. But when I load one page with js file link in it. The file just get an error:
$ is not defined
I can't figure it out. Thank you all for your help!
Upvotes: 0
Views: 303
Reputation: 896
This question explains the position of jQuery script.
You can see from this answer that people recommend putting the script at the bottom of the page, because it allows rendering of the page sooner. However, you can't reference the script if it hasn't been loaded yet.
If you don't fully understand how it works, no offense but I think it will be fine to load the script in the <head>
as recommended above, you probably won't see too much rendering difference as a beginner.
Upvotes: 1