0

这是我的控制器动作...

    // GET: ex: /Question/Details/5?project=1
    public ActionResult Details(int? project, int? questionId)
    {
      ...
    }

这是我的淘汰赛虚拟机:

    // Get some other info about question
    $(document).ready(function () {
            getSomeOtherInfo(<need to pass question id here>, <need to pass project id here>);
    });

任何帮助将不胜感激。

4

1 回答 1

0

如果您对详细信息使用强类型 ViewModel,则可以将这两个属性添加到视图模型中,然后在视图中将值提供给 JavaScript:

$(document).ready(function () {
    getSomeOtherInfo(@(Model.project), @(Model.questionId));
});

如果你没有使用强类型的 ViewModel,你可以使用 ViewBag

于 2013-02-07T20:05:40.553 回答