My goal: Include one html file (the header of my website) into many other html files (each page of my website).
I do not want to copy and paste my header html into each of my websites pages. When I want to change my header html, I do not want to have to go through each webpage and change all the headers.
My current (not working) solution: Use jquery's .load() function to load my header html into a div. My code:
header.html:
<h1>I am a header</h1>
index.html:
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script>
$(function(){
$("#header").load("header.html");
});
</script>
</head>
<body>
<div id="header"></div>
</body>
</html>
This is very similar to so questions like this one, yet my code still does not work. Could it have something to do with the fact that this is all being rendered by django's templating engine? header.html is in the same directory as index.html