ajax 如何传类实体类
前台
ajax $.ajax({
url: "http://xx/api/UserLogout",
type: "post",
contentType: "application/json",
dataType: "text",
data: JSON.stringify(RequestContent),
success: function (result, status) {
alert(result)
},
error: function (error) {
alert(error);
}
});**
后台方法:
public IHttpActionResult UserLogout(RequestContent request)
{}
RequestContent的类
public class RequestContent
{
public string Token { get; set; }
public string Content { get; set; }
}
ajax date传递这个 RequestContent