I am trying to use Jquery to load html code into another html file, using Jquery's the .load() method.
I have tried using an absolute path to access the file but I am still getting the same error. I have also tried navigating to absolute path and the file and it will open with no problem in a browser so it dose not appear to be an accesses issue. I have also mapped to the latest version of jQuery instead of my local version.
The error response is unidentified which is making this problem harder to solve:
Updated Code: made changes to code from user recomendations.
Main HTML Page
<script src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
<script type="text/javascript">
jQuery(document).ready(function(){
jQuery("#test").load("/menu.html", function(response, status) {
if(status === 'error') {
alert("Failed to load menu.html");
}
else {
alert("Success!");
}
});
});
</script>
</head>
</head>
<body>
<div id="test"></div>
</body>