This is my code:
$(document).ready(function () {
var na = $("#navDivA");
var nb = $("#navDivB");
var ca = $("#contentA");
var cb = $("#contentB");
var la = $("#home");
var lb = $("#about");
var firstSession = true;
na.on("click", function () {
ca.load("home.html", function(){
alert("Loaded");
});
});
nb.on("click", function () {
cb.load("about.html");
});
});
<div id="wrapper">
<div id="navDivA"><a id="home">Home</a></div>
<div id="navDivB"><a id="about">About</a></div>
<div id="contentA"></div>
<div id="contentB"></div>
</div>
Why does it alert multiple times every time I start to click? How can I avoid this? I want to load the html file once.
one()Anyway, your question is missing context to make it clear