1

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.

2 Answers 2

2

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Yeah which I do have headers caching my files. But another problem seems to arise, when I did load('example.php')... AND I included the main javascript file again, and ran a function, it dupilcated the 'animation' because it seemed to see that the file was loaded 2 times...
2

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.