Reputation: 1354
So just a general question: if i have a file structure like this where i have an index page in the root folder along with a scripts folder, and in the scripts folder there are two scripts one a JS which is referenced in the index page, and the other PHP which is referenced from the js script:
root-folder:
--> index.html
--> scripts/
-----> myscript.js
-----> myscript.php
how should I access the php script from the js script using a relative url?
would it be: ./myscript.php
or ./scripts/myscript.php
in other words is the relative url from the index file or the js file. thanks!
Upvotes: 0
Views: 79
Reputation: 101
Since the javascript is operating in the scope of the page, not its physical location, the URL to the PHP would include /scripts/ in the path name.
Upvotes: 1