I have an Ajax Form in a C# MVC webapp. The users interactions on the page will automatically trigger some jQuery/javascript to submit the form.
$('#hiddenUpdateForm').submit();
The form I am submitting is in a codeblock:
using (Ajax.BeginForm("Update", "Controller", new AjaxOptions { HttpMethod = "POST", OnSuccess = "updatefunction(data)", }, new { id = "hiddenUpdateForm" }))
{
@Html.AntiForgeryToken();
@Html.Hidden("name");
@Html.Hidden("value");
}
Is there any way to cancel/abort/terminate an ajax query using Ajax.BeginForm if a user triggers a new update before the original update results are returned to the browser?
Something similar to Abort Ajax requests using jQuery except preferably only using c#, not jQuery. I am aware that the controller-action will still process the previous request however I need the users experience to be based on the most recent action they have triggered.