After reading a couple of other posts on Stack Overflow, I decided to use the jQuery method of adding a navbar to index.html
whose code is in header.html
. However, the navbar is not showing up on index.html
, and the console says that there is an "Access to XMLHttpRequest error". Could someone please tell me why this error is appearing?
Here is my HTML for index.html:
<!DOCTYPE html>
<html>
<head>
<link href="header+footer.css" rel = "stylesheet" type="text/css" />
<link href="index.css" rel = "stylesheet" type="text/css" />
<meta charset="utf-8">
<title> The Novel Column - Book Reviews </title>
<script src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
<script>
$(function(){
$("#includedContent").load("header.html");
});
</script>
</head>
<body>
<div id="includedContent"></div>
Here is my HTML for header.html:
<nav>
<img class="logo" src="images/other/logo.jpg">
<h1> <a href="index.html"> The Novel Column </a> </h1>
<ul>
<li> <a href="about.html"> About </a> </li>
</ul>
</nav>
Thanks in advance for your help!