I have 2 classes that are used to mirror the data from an ajax call. One (Customer) contains a property which is name, and the other is an array of Products.
Public Class Customer
Private _Name as String
Private _Products as Product()
Public Property Name() As String
Get
Return _Name
End Get
Set(ByVal value As String)
_Name = value
End Set
End Property
Public Property Products() As Product()
Get
Return _Products
End Get
Set(ByVal value As Product())
_Products= value
End Set
End Property
and the ajax call:
$.ajax({
url: '../../Customer/SaveCustomerData',
type: "POST",
dataType: "json",
data: { "Name": this.Name,
"Products": [{ "ProductCode": "product 1", "ProductName": "product 1" },
{ "ProductCode": "product 2", "ProductName": "product 2"}]
},
success: function(data) {
alert("Customer has been saved!");
}
});
The value for Customer.Name is reflected but the properties of the Products remain nothing while still having a length of 2.
Am I missing something really important here?