![](/img/trans.png)
[英]Internal Server Error #500 while trying to display JSONResult with jQuery ajax and MVC
[英]Returning JsonResult is giving Server 500 error?
首次嘗試MVC。 試圖返回JsonResult。 我在我的控制器中有這個:
[AcceptVerbs(HttpVerbs.Get)]
public JsonResult GetHistoricalReports()
{
JsonResult result = Json("test");
//JsonResult result = Json(DashboardSessionRepository.Instance.HistoricalReports);
return result;
}
在我看來:
function OnHistoricalListBoxLoad(historicalListBox) {
$.getJSON('GetHistoricalReports', function (data) {
alert(data);
}
我在GetHistoricalReports中設置了一個斷點,它確實被擊中了。 但是,OnHistoricalListBoxLoad中的警報永遠不會顯示。
您需要返回結果,如:
return Json("test", JsonRequestBehavior.AllowGet)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.