Ian Warburton
Ian Warburton

Reputation: 15676

Ajax.ActionLink making two requests

@Ajax.ActionLink("Sales file", "Product", "Import", null, new AjaxOptions{ LoadingElementId = "spinner"}, new {@class="import"})

Its making two requests. One has the following on the query string...

?X-Requested-With=XMLHttpRequest /Import

I have looked at this but I'm sure that I only have one reference to ajax.unobtrusive in the page.

Any ideas?

Upvotes: 0

Views: 472

Answers (1)

Darin Dimitrov
Darin Dimitrov

Reputation: 1038810

I suspect that you have some other javascript file included in your page which is AJAXifying all links. Something along the lines of:

$('a').click(function() {
    $.get(this.href, function(result) {

    });
    return false;
});

So you get 2 AJAX calls - one as a result of the jquery.unobtrusive-ajax.js script and the other as a result of your custom script.

Look at all the scripts that are included in your view and start removing them one by one until you find the smoking gun.

Upvotes: 2

Related Questions