ASP.NET MVC Url.Action in JQuery is not recognized

后端 未结 4 751
无人及你
无人及你 2020-12-06 11:03

I am trying to use Url.Action() method in my js file to define urls for my ajax calls. So far I have failed.

 $.ajax(
 {
    type: \"POST\",
    url: \'@Url.         


        
4条回答
  •  清歌不尽
    2020-12-06 11:59

    You can't use '@Url.Action("SomeAction", "SomeController")' in js file, because this is ASP.NET MVC helper, if you put your code to the view everything will work.

提交回复
热议问题