I have a website with index.html
in the root folder, and a folder named apples
. Inside apples
I have another index.html
. Currently I am attempting to use AngularJS to load the same navbar into both pages. However, when I tried linking to the Javascript file like so: <script src="/controller.js">
, the JS file loads for the index.html
in the root folder, but it refuses to load the file for the index.html
in the apples
folder. Does anyone know why? In the apples
folder, it keeps linking to apples//controller.js
.
<script src="../js/controller.js"></script>
__ ______ ________
| | |
| | |___ 3. Get the file named "logo.png"
| |
| |___ 2. Go inside "images/" subdirectory
|
|
|____ 1. Go one level up
Are you running this on a server or just on your desktop? The path /controller.js should work if you're running from a web server but likely won't work if you're calling it locally.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.