how should i reference a php file from an external javascript file

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!


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.

Need Your Help

Choosing a JS MVC Framework with large support for desktop and mobile browsers

javascript mobile model-view-controller frameworks

We have built an app using Knockout.js and targeting desktop browsers (Chrome, Moz, IE7+) as well as Safari, Android stock browser, Chrome for mobile, stock browsers of BlackBerry 7 and windows pho...

Need help on dynamically creating navigation links based on content created in Umbraco

umbraco umbraco6 umbraco7

i am very much new in Umbraco CMS and started coding in it recently. My page structure is like this