我正在尝试使用 ViewData 将 Json 传递给我的视图
控制器
ViewData("JsonRegionList") = Json(RegionService.GetActiveRegions())
看法
$("input#UserRegion").autocomplete({
source:"<%: ViewData("JsonRegionList").ToString %>",
minLength: 3,
但我遇到的问题是输出源看起来像
$("input#UserRegion").autocomplete({
source:"System.Web.Mvc.JsonResult",
minLength: 3,
这显然是不对的。我错过了一些基本的东西吗?