MVC 3 Ajax请求堆积

I have the following code:

$('.defaultLink').click(function () {
        $.ajaxSetup({ cache: false });
        cleardiv();
        $('#mainContent').empty()
        $('#mainContent').load(this.href).val();
        return false;
    });

This is to load a partial view into a div. Problem is, The GET Requests that i see in firebug seem to heap up, First there is one, then when i click again theres 2, then 4, 8 and so on.

This made me think that i need to clear the div thats being loaded into, but it doesnt seem to work, Any help would be appreciated!

Personally, I prefer to control caching on the server. You can decorate your action/controller with:

[OutputCache(NoStore = true, Duration = 0, VaryByParam = "*")]

To prevent caching.

Also I'm pretty sure the '.val()' is not necessary following '.load()' although couldn't say for sure whether this was causing duplicate requests.

Are you saying that each time you click, the number of events fired actually doubles? If so, is it possible that your click definition code (shown in your question) is being run multiple times? Put a break on it in Firebug and see. Also, put a break point on the server code to ensure that there really are multiple requests coming in.

Does your cleardiv() function clear mainContent? That would be redundant if you already have empty(). In fact, the load() should replace the contents as well.