简体   繁体   中英

How to refer javascript file in html present in another folder

I have a JS file in folder /admintool/src/main/webapp/static/js/itemInventory.js

i have html file in folder /admintool/src/main/webapp/WEB-INF/templates/itemInventory.ms

On page load my starts with url - http://localhost:8080/admintool/selectItem/showAllItems

Inside itemInventory.ms file, when i use the below code to refer that javascript, it is not able to detect it.

<script src="static/js/itemInventory.js"></script>

In browser console, i get an error GET http://localhost:8080/admintool/selectItem/static/js/itemInventory.js net::ERR_ABORTED

How do i specify the location of this JS file properly ?

Are you sure, that the links are right? The link from the HTML to the JavaScript have to be: ../../static/js/itemInventory.js

Ivo

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM