How to stop Jquery load function

Posted by Sergio on Stack Overflow See other posts from Stack Overflow or by Sergio
Published on 2010-05-10T16:40:00Z Indexed on 2010/05/10 16:44 UTC
Read the original article Hit count: 299

Filed under:

The Jquery load function don't stop if there is multiple click on the links in the menu.

The jquery code looks like:

$(document).ready(function(){

$(".menu_rfr").unbind("click").click(function() {
$("#main").html('<img src="img/spin.gif" class="spin">');
location.replace($(this).attr('rel'));
});

function handleClick() {
$(this).unbind("click");
$("#main").html('<img src="img/spin.gif" class="spin">');
$("#main").load($(this).attr('rel'), function() {

    // reactivate it after some loading has completed
    $(this).click(handleClick);        
});         
}
$(".menu_clickable").click(handleClick);
});

You can see the sample page at link text

How can I prevent users clicks if the DIV content is not loaded completely and never ending DIV loading?

© Stack Overflow or respective owner

Related posts about jQuery