public ActionResult GetAllKnowledgeInfo()
{
var knowlegeInfo = _knowledgeBaseAppService.GetAllKnowledgeInfo();
return new JsonResult { Data = JsonConvert.SerializeObject(knowlegeInfo),
JsonRequestBehavior =
JsonRequestBehavior.AllowGet };
}
JsonResult作为返回值,Data属性可赋任意对象返回到前端(序列化),
JsonRequestBehavior属性很多情况下是必填项,否则前台可能接收不到数据。
网友评论