i've an ajax request in my code as shown below:
function show_detail()
{
$('#product_'+index).html('<img src="/loading.jpg" style="margin-left:450px;"> loading...');
$.ajax({
type: "GET",
url: "someUrl",
data: dataString,
success: function(msg){
$('#product_'+index).html(msg);
}
});
}
My requirement is to call the function show_detail() when clicking any of the product images in a group of product images and display the loading image in a div until the details of a product is completely loaded form ajax request. When the product details are loaded from ajax request I've to overwrite the same div with product details.But the problem is when clicking multiple links at the same time I'm getting more than one loading image the subsequent divs. So I want to wait until the last ajax request is completed while calling the same function (show_detail()) subsequently and show only one loading image at a time. Also I don't want to freeze the browser with async:false
Thanks in advance.