Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

External file script is not loading

Iam using load() for loading external html file.

$("#header_section").load("header.html");
$("#sidemenu_section").load("side_menu.html"); 

Here, HTML file is loaded and css also loaded but script file is not loading in the page

<script src="js/utility.js"></script>

I tried to declare the above script file inside the head and inside the body. Both are not working.

like image 331
Deen Avatar asked Oct 31 '22 01:10

Deen


1 Answers

Check your relative path to the utility.js file and make sure to load juery.js library before load utility.js file.

and finally try this,

<script type="text/javascript" src="${pageContext.request.contextPath}/js/utility.js"></script>

to load the utility.js file.

like image 137
dennypanther Avatar answered Nov 13 '22 19:11

dennypanther