Bren
Bren

Reputation: 3696

Where does jquery's getscript() function look when called in an external file?

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?

Upvotes: 0

Views: 1275

Answers (1)

Cerlin
Cerlin

Reputation: 6722

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

Upvotes: 3

Related Questions