ASP.NET MVC public alternative to UrlHelper.GenerateUrl

后端 未结 2 714
深忆病人
深忆病人 2020-12-09 04:41

I want to embed a link to a controller action in my page so I can use it from javascript. Something like

var pollAction = \'/Mycontroller/CheckStatus\'
         


        
2条回答
  •  独厮守ぢ
    2020-12-09 05:29

    Have you tried something along these lines?

    var pollAction = '<%=Url.Action("CheckStatus", "MyController") %>';
    

提交回复
热议问题