How to cancel jQuery download

My problem is that my main page loads some slow asp pages into my divs via jQuery:

$("#content").load("really_slow.asp");

But if I try to go to another page of my site by clicking the link before the ASP page is complete, it will not let me go until the download is complete.

I tried several ways, but nothing works. I tried something like this:

var request = $.ajax({
    type: 'GET',
    url: 'really_slow.asp',
    success: function(result){
        $("#content").html(result);
    }
});


$("a").click(function() { 
    request.abort();
});

no difference...

+5
source share
2 answers

This is not jQuery - see this demo: http://jsfiddle.net/H6j4k/1/

IIS. ASP, , IIS . AJAX , IIS - .

. . , , , , , IIS . , , . , , .

+1

, . :

var request = $.ajax({
    type: 'GET',
    url: 'really_slow.asp',
    success: function(result){
        $("#content").html(result);
    }
});


$("a").click(function() { 
    request.abort();
});

abort() jqXHR, div #content. : Ajax jQuery

+3

All Articles