0
代碼的工作原理除了接收地址的子集合嗎?在json中發送這個集合的正確方法是什麼?不幸的是這種嘗試失敗在 '地址' 值爲null 感謝,如何發佈ajax調用和C#來識別子對象
var val = {
'forename': 'test',
'surname': 'test',
'postcode': 'test',
'Addresses': {
'Line1': 'Test',
'Line2': 'Here'
}
};
jr.ajax.loadJson(url, val,
true,
function(xhr, textStatus, errorThrown) {
},
true, 'post', val);
});
// I want the posted value to be this object
public class Member
{
public string forename { get; set; }
public string surname { get; set; }
public string postcode { get; set; }
public Address[] Addresses { get; set; }
}
public class Address
{
public string Line1 { get; set; }
public string Line2 { get; set; }
}
我的控制器看起來是這樣的:
public ActionResult Show(Member request) {..}