-1

In php website I am using different javascript functions in different pages for example page a calls functions 1,2,3 and page b calls functions 2, 4, 6 and page c calls functions 3, 6 can I place all javascript functions in one file

marked as duplicate by gnat, user40980, BЈовић, Arseni Mourzenko, user53019 Mar 13 '15 at 19:53

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • yes. you will get advantage of reduced http hits to server. in your case if you have proper expiration and cache headers for your javascript file, you can reduce 60% traffic for that resource. – Sureshkumar Natarajan Mar 11 '15 at 7:41
0

Yes. In HTML you can include an external Javascript file like this:

<script src="js/six_util_functions.js"></script>

So as long as your PHP outputs that in the right place, you should have no trouble calling functions 1-6 from anywhere in your HTML pages.

Not the answer you're looking for? Browse other questions tagged or ask your own question.