在某处查看我需要从返回 json 对象的操作中分配值,我想分配如下:
<script type="text/javascript">
var jsonFromAction = @Html.Action("GetMenuJson", "Test");
</script>
我的控制器操作代码如下:
public ActionResult GetMenuJson(int? subCategoryId)
{
_lCatService = new LeftCategoryService();
List<FlatObject> flatObjects = _lCatService.GetCategory(UIUtility.Uitlity.CurrentLanguageCode);
return Json(GetList(flatObjects, 0), JsonRequestBehavior.AllowGet);
}