Reputation: 4007
I have a 2 directories, a
and b
. a
contains a page that needs to reference a script file in b
.
How do I do this? I seem to remember that I have to do something like:
<script src="../b/jquery-1.6.min.js" type="text/javascript"></script>
Upvotes: 0
Views: 76
Reputation: 120516
If you serve the page from http://example.com/a/foo.html
, then including that code should load the script from http://example.com/b/jquery-1.6.min.js
unless you have a <base href="...">
in your page.
If it doesn't seem to be working, put a link on your page
<a href="../b/jquery-1.6.min.js">debug JS</a>
and load the page and click the link. You can see the complete URL by looking at your browser's URL bar.
If the link URL is not as you expect, you probably have a <base href="...">
in your page. Letting us know that will help us find a relative URL that works for you.
If the URL is ok, but the content of the JS does not show in the browser, then your server is probably misconfigured. We would need more details about your server to provide feedback on that.
Upvotes: 1