My class
[Serializable]
public class VSpecialQualifiers
{
public VCD LivingStatus { get; set; }
public VCD Relationship { get; set; }
public string OnSetAge { get; set; }
}
My js function
$.ajax({
url: url,
type: 'POST',
datatype: 'json',
data: {
'arr' : self.specialQualifiers
}
});
My serverMethod
[HttpPost]
public JSONResult SaveProblem(object[] arr)
{
//i cant't cast to target type
}
How i can pass the array of objects from js to server?
Here’s something that works for me (to C# MVC on the back end).
…in the js:
… in the controller, the signature here is all that matters:
…and this is an associated ViewModel definition that works where WorksheetItemVM is the viewmodel DTO that contains the list of fields for each of the Js objects being passed :