In a legacy MVC 5 web app I want the user to be able to continue browsing after clicking a button which makes an ajax call to a long running action.
(Note: The action returns void
- I am not interested in the response)
When I click the button I am unable to make any other requests until the action completes.
Edit: Here is the ajax code:
$('#EmailReport') //
.click(function() {
$.ajax({
type: "POST",
url: '/Home/EmailReport',
complete: function() {console.log("done")},
async: true
});
});
Controller
[HttpPost]
public async Task EmailReport()
{
// for testing - sleep for 10 seconds
await Task.Delay(TimeSpan.FromSeconds(10));
}
Here is a screenshot in Chrome dev tools:
EmailReport
is the ajax call, the two requests at the bottom are me trying to browse to another page - as you can see the first request is pending
and any subsequent requests are cancelled
Does anyone have any ideas how I can resolve or troubleshoot this issue?