0

If i have a file system like:

project -> public -> js -> myfile.js

If i call getScript() in myfile.js where does it look at first? Is this generally true for other things?

For example if I call getScript("myotherfile.js") and myotherfile.js is in the js folder would that be sufficient to access myotherfile.js?

Does the getscript call from my html document or myfile.js?

1 Answer 1

3

the path will be taken from the url which is appearing in the browser.

ie)

if the site url is example.com/test1/test2/ and the call is made from this page and if you are mentioning / infront of the js file url then the end result will be like example.com/myotherfile.js. if you are not putting any slash then it will refer like example.com/test1/test2/myotherfile.js.

NOTE: i am not sure if i got your question right.

for more info please read on absolute paths and relative paths

LINK for reference

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

1 Comment

Agreed. It has nothing to do with the filesystem structure; it's all relative to the URL structure.

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.