我想在请求请求后获取数据,我在客户端有以下代码:
function (data) {
console.log((data));
const requestOptions = {
headers: { 'Authorization': 'Bearer ' +
sessionStorage.getItem("accessToken") } };
return $http.post("/api/Account/Filter", data, requestOptions);
}
这是在服务器端:
public IHttpActionResult Filter(Models.DataSourceRequest request)
{
var employees = db.Users.OrderBy(ii => ii.Id).Select(x => new
RegisterBindingModel()
{
Id = x.Id,
Email = x.Email,
UserName = x.UserName,
FirstName = x.FirstName,
LastName = x.LastName,
Age = x.Age,
Phone = x.Phone,
Department = x.Department
});
var i = employees.ToDataSourceResult(request.Take, request.Skip, request.Sort, request.Filter);
var data = i.Data; // This is contain filtered data
request.Take = i.Total;
System.Diagnostics.Debug.WriteLine(Json(data));
return Json(i.Data);
}
如何将数据发送到客户端?