在 JS 中,你得到下一行:
var careteam = "[{"GroupId":3,"GroupName":"Physician","Users":[{"UserId":3438,"
如果我们阅读这一行,它会为您提供变量声明var careteam = "[{"
,在您拥有GroupId":3,"GroupName":"Physician","Users":[{"UserId":3438,"
这对 JS 没有意义之后。
将剃刀语法更改为:
var careteam = '@Html.Raw(Json.Encode(Model.CareTeamForFile))';
所以在careteam
你会有一个字符串
var careteam = '[{"GroupId":3,"GroupName":"Physician","Users":[{"UserId":3438," ... '
但我敢打赌这不是你想要的,你想在 中有一个数组careteam
,所以我猜这是正确的解决方案:
var careteam = @Html.Raw(Json.Encode(Model.CareTeamForFile));
你会得到 JS:
var careteam = [{"GroupId":3,"GroupName":"Physician","Users":[{"UserId":3438," ...