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