alidads alidads - 1 year ago 66
jQuery Question

how to connect to jquery in other page

one of home PHP page have so many jquery's lines like this...

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

And I'm trying to clear up the codes and make organized the code, I was wondering if this will work by put all jquery's lines into other page and put the name as all.jquery.js! if so how can I link from home page to all.jquery.js..?

I have tried using
<script src="js/all.jquery.js"></script>
in home page and is not working.

what did I miss!


Answer Source

You cannot source an html file as a script.

But you can use RequireJS which basically calls all JS files from a specified path.

<script data-main="scripts/all.js" src="scripts/require.js"></script>

Then you call the rest of the JS files inside “all.js” –

Read on how to call your JS files accordingly.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download