In my application, I've a left menu with some links :
<div>
<a onclick="menuclick('user')">User(100)</a>
<a onclick="menuclick('messages')">Messages(1000)</a>
<a onclick="menuclick('contact')">Contact Us</a>
</div>
On click of each links, I'm calling an ajax which will call a file and queries table and display content accordingly.
function menuclick(type) {
$.ajax({
url: 'test.php',
type: 'POST',
data: {
type: type
},
dataType: 'html',
success: function(data) {
$("#contentdiv").html(data);
}
});
}
Now the issue is, if the user/message count in database is a greater number, then its taking some time to load the content/processing test.php file. If I click some other links in this time, it will not display suddenly. On click of each links, how can I show the content immediately without waiting for other links ajax processing to complete.
Can anyone help me to find a solution?