Reputation: 2530
I have written my website to have a main, JavaScript/jQuery file that houses most of my main functions.
But on my page I am using some .load("example.php")
functions, to help save the main load page time. The problem I'm running into is that WITHIN example.php
I have to load my MAIN JavaScript/jQuery file again if I want to use some of the main functions that I have loaded.
But that doesn't seem very smart and efficient, is there something I'm missing that would enable me to not have to do that????
Any light would be appreciated on this topic. cheers.
Upvotes: 1
Views: 101
Reputation: 700192
You only need to load the Javascript file once per page. If the main page has loaded it, you don't need to load it again when you load more content into it.
Upvotes: 2
Reputation: 43235
Do not worry, you can use cache headers to setup caching time for your file. So the next call will be made, but will take the file from cache and not your server.
Upvotes: 2