I have this line in my Razor :
@Html.Raw(File.ReadAllText(Server.MapPath("~/Views/Home/index.html")))
And in HTML file, I have this :
<li><a href="#">Personal Records</a></li>
And in my js file I have this :
if ($(link).text() === 'Personal Records') {
$("#govde").load("PersonalRecords.html");
}
But when I click on that link, nothing happens. When I open Index.html directly from file browser, it works. How can I fix this?
EDIT :
In console, it has this :
http://localhost:12345/PersonalRecords.html 404 (Not Found)
I guess I have placed the html files to a wrong folder. Can you tell me where to place? Thanks.
EDIT2 :
I have this in my JS :
var upperMenu = document.getElementById('upperMenu');
var requests = document.getElementById('requests');
$(upperMenu ).click(function (event) {
ustMenu.childNodes.forEach((myList) => {
$(myList).attr('class', ' ');
});
var link = event.target;
var list = link.parentNode;
$(myList).attr('class', 'active');
if ($(link).text() === 'Personal Records') {
$("#govde").load('@Url.Content("~/PersonalRecords.html")');
}
});
.load function is created in this(seperate) JS file.
$(a)(not$(link)) but I recommend you give your element anidor class name rather than checking its inner text valuelinkhold! so try adding complete js code..htmlfiles? Which directory?@Url.Contentwith relative path to your HTML file, e.g.$("#govde").load("@Url.Content("~/Views/Home/PersonalRecords.html")");?