I decided to design my new job that I use Ajax and i use this cod for load page
html
<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
<link rel="stylesheet" type="text/css" href="style.css"/>
<script src="jquery.js"></script>
<script src="script.js"></script>
</head>
<body>
<div class="menu">
<ul>
<li class="page2" id="page2">PAGE TOW</li>
<li class="page3" id="page3">PAGE THREE</li>
</ul>
</div>
<div class="load"></div>
</body>
</html>
js
$(document).on('click','.menu li',function(){
var $this = $(this);
if($(this).hasClass("page2")) {
$(".load").load('page2.php');
}
else if($(this).hasClass("page3")) {
$(".load").load('page3.php');
}
});
This works properly ! But many times when I click on tabs Browser hangs... My question is whether I badly written code? Or this is normal in Ajax If there is a way to help or not use of Ajax