0

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>
0

1 Answer 1

1

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.

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

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.