smitty62
asked on
Can't get js include to work in html file
I want to have my main drop down menu as an include in a html page. I cannot figure out why this js won't work. It's the standard way of pulling in code for html5. Here is the page with the drop down working when the code is not an include:
http://insuranceqa.illinois.gov/testsite3d/default.html
Here is the page with the js include code
http://insuranceqa.illinois.gov/testsite3d/default2.html
The code I'm using is
The div placement is <header class="navbar navbar-static-top soi-header" id="includeMainMenu">
What am I missing here?
http://insuranceqa.illinois.gov/testsite3d/default.html
Here is the page with the js include code
http://insuranceqa.illinois.gov/testsite3d/default2.html
The code I'm using is
<script>
$(function(){
$("#includedMainMenu").load("includes/headerMenu.html");
});
</script>
The div placement is <header class="navbar navbar-static-top soi-header" id="includeMainMenu">
What am I missing here?
ASKER
I also tried <link rel="import" href="includes/headerMenu. html"> that didn't work either. Since this is .html and not .asp <!--#include virtual="Includes/headerMe nu.html" --> will not work either.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Why is the path code showing up in the pull down menu?
http://insuranceqa.illinois.gov/TestSite3D/default2.html
http://insuranceqa.illinois.gov/TestSite3D/default2.html
ASKER
It wasn't working before, but it is now, however, I still see a problem. In my asp pages I used <%response.write(Applicati on("root") )%> so that I could still use a relative path and a global.asa . Now that I'm developing this in html that will not work. Is there a way i can get the same result without turning on the parent path in the server?
ASKER
Unless you know of another way I'll just use the qualified full path in the include dropdown.
ASKER
Sorry to have bothered you. The drop down wasn't working at all when I ask the question, but now it is. Maybe it was just closing and reopening the browser that caused it to work. Thank you for your time.
Sounds like a caching issue - the javascript that loads the html probably was not loading due to the fact that the page loaded was the cached version.
ASKER