Razor 在JS中嵌入后台变量
HTML 中定义全局变量
@{
int CurrentUserId =ViewBag.CurrentUserId;
}
JS中取值方式var CurrentUserId = parseInt(@Html.Raw(CurrentUserId));
HTML 中定义全局变量
@{
int CurrentUserId =ViewBag.CurrentUserId;
}
JS中取值方式var CurrentUserId = parseInt(@Html.Raw(CurrentUserId));