I have an Ajax call as below from my client js files to an MVC acontroller method
From the client js files ::
var ActivityLog = new Array();
var Test={}
Test['Customer[0].Id'] = "3060_3";
Test['Customer[0].Value'] = "0";
Test['CustId'] = "1111";
Test['crl'] = true;
Test['ActNumber'] = "2222";
for (var i = 0; i < 2; i++) {
Test['ActivityLog[' + i + ']'] ="1";
}
My Controller ActionMethod ::
public ActionResult SaveAccountCustomerServicePlans(string CustId, IDictionary<string, Customer> Customer, bool? crl, string ActNumber, string[] ActivityLog)
{
// Here all the parameter i am getting as null
}
My entity class
public class Customer
{
[DataMember]
[Key]
public int Id{ get; set; }
[DataMember]
public string Value{ get; set; }
}
My Ajax call::
$.ajax({
type: 'POST',
async: true,
});
$.ajax({
beforeSend: function (xhr) {
xhr.setRequestHeader('__RequestVerificationToken', $(':input:hidden[name*="RequestVerificationToken"]').val());
},
type: "POST", url: "Customerss/Customermanagement/SaveAccountCustomerServicePlans", data: { Test: Test},
success: function (data) {
/////
}
});
In above controller method all the parameters i am getting as null . But aif i remove ActivityLog from Test object everything works fine . Can anybody please help me to solve this issue.