是否有任何示例將多個對象發佈到控制器。 ajax文章的數據如何看起來像?MVC4控制器發佈多個json對象到控制器,ajax post
[HttpPost]
public string Register(UserLogin userLogin, Contact contact)
{
}
用戶登陸
public class UserLogin
{
public string Username { get; set; }
public string Password { get; set; }
}
聯繫
public class Contact
{
public string Firstname { get; set; }
public string Lastname { get; set; }
}
AJAX?
$.ajax({
type: "POST",
url: "SomeUrl"
dataType: "json",
contentType: "application/json; charset=utf-8",
data: ? });