Posts

Showing posts from July, 2018

How to use JQuery Ajax Methods for Async ASP.NET MVC Action Methods

Making repeatedly calls to async methods can be a nightmare. In this case, it makes sense to use 2 ajax methods, instead of one.

Here is a simple solution to overcome this problem. See that ajaxcallsis emptied after the success response for the first ajax call and then the second ajax method is used to make one single call to the async action method.

Hope it helps.


View:

@section Scripts{ <scripttype="text/javascript">
var smartDebitObject = new Object(); smartDebitObject.MembershipNumber = $("#MembershipNumber").val(); smartDebitObject.ProfileId = $("#ProfileId").val(); smartDebitObject.FirstName = $("#FirstName").val(); smartDebitObject.LastName = $("#LastName").val(); smartDebitObject.AddressLine1 = $("#AddressLine1").val(); smartDebitObject.Postcode = $("#Postcode").val(); smartDebitObject.Town = $("#Town").val(); smartDebitObject.FrequencyType = $("#FrequencyType").val(); var request = JSON.string…