I have a Ajax call to a WebApi method. My Call is looks like this:
function CalculateAmortizationScheduleAPI() { $.ajax({ url: 'http://localhost:62815/v1/APR/Calculate', type: 'POST', dataType: 'json', data: { "LoanAmount": 200000,"Costs": 100,"Term": 15,"Rate": 2.2,"RateType": 2,"Points": 1,"MIRate": 2.2,"UFMIRate": 2,"FixedTerm": 5,"FirstPaymentDate": "10/10/2017","RateChangeDate": "10/10/2018","AdjustTerm": 2,"IndexRate": 2,"Margin": 2,"AdjustmentCapFirst": 2,"AdjustmentCap": 2,"AdjustmentCapLifetime": 2,"EstimatedPropertyValue": 2,"CancelMIPMonths": 2,"CancelMIPLTV": 2,"AdditionalPricipalPayment": 2,"ConstantPaymentValue": 2 }, success: function (data) { alert("success"); }, error: function () { alert("Error"); }, }); }
And this is my WebApi method that Ajax call successfully hit when I put the breakpoints and also the return value has value as a object.
[HttpPost]publicDictionary<int,AmItem>Calculate([FromBody]AmArguments lAmArguments){.....returnAmSchedule;}
The problem is that even though the Ajax call hit the method but the Success method is not executing and the Error Alert will appear in the screen, Also I don't know how to capture return value that is complex object (AmSchedule)