我正在尝试使用Ajax获得结果, 我的模型是
public class Flight
{
public int FlightId { get; set; }
.
.
.
}
我的ViewModel是
public class FlightSummary
{
public Flight Flight { get; set; }
public DateTime DepartureDate { get; set; }
public DateTime ReturnDate { get; set; }
}
在控制器中,我有
public JsonResult Get( SearchInput search )
{
IEnumerable<Flight> flights = repository.Flights.Where(...).Select(f => f);
List<FlightSummary> flightsList=new List<FlightSummary>();
foreach (Flight flight in flights)
{
FlightSummary fs = new FlightSummary{
Flight = flight,
DepartureDate = search.DepartureDate,
ReturnDate = search.ReturnDate
};
flightsList.Add(fs);
}
return Json(new
{
status="Ok",
data=flightsList
});
}
我已经检查了排行榜值,它是正确的,但是当我使用console.log时,在浏览器中没有任何数据结果,有什么建议吗?抱歉,我是Asp.net的新手 谢谢