I have made two buttons to open two different php pages.
when I click on any of them, it load the respective url into the div. but when when I click another button, it is slow to load the another page.
Switching between button is very slow. sometimes seemes like button does not even work..or hanged.
<div id="ButtonNav" style="width:1487px;margin:10px auto 0;">
<button class="tablink" onclick="openPage('url1.php', this, '#f9bd48')" id="defaultOpen">Admin</button>
<button class="tablink" onclick="openPage('url2.php', this, '#f9bd48')">DB management</button>
<div id="myContent"></div>
</div>
and java script function is so
function openPage(pageName,elmnt,color) {
$("#myContent").load(pageName, function(){
});
tablinks = document.getElementsByClassName("tablink");
for (i = 0; i < tablinks.length; i++) {
tablinks[i].style.backgroundColor = "";
}
document.getElementById("myContent").style.display = "block";
document.getElementById("myContent").style.backgroundColor = color;
elmnt.style.backgroundColor = color;
}
any guess or help what shall I do better to get optimum performance?
Thanks in advance