Link to home
Start Free TrialLog in
Avatar of smitty62
smitty62Flag for United States of America

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

 <script>
            $(function(){
                $("#includedMainMenu").load("includes/headerMenu.html");
            });
</script>

Open in new window


The div placement is  <header class="navbar navbar-static-top soi-header" id="includeMainMenu">

What am I missing here?
Avatar of smitty62
smitty62
Flag of United States of America image

ASKER

The fact that I'm using jquery.min.js  instead of jquery.js wouldn't make any difference would it?
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/headerMenu.html" -->  will not work either.
ASKER CERTIFIED SOLUTION
Avatar of Julian Hansen
Julian Hansen
Flag of South Africa image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Why is the path code showing up in the pull down menu?

http://insuranceqa.illinois.gov/TestSite3D/default2.html
It wasn't working before, but it is now, however, I still see a problem.  In my asp pages I used  <%response.write(Application("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?
Unless you know of another way I'll just use the qualified full path in the include dropdown.
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.