Use Separate js File And use Url Helpers in it with ASP.NEt MVC 3 and Razor View Engine

前端 未结 6 960
太阳男子
太阳男子 2020-12-15 06:22

I ask a similar question here and Darin Dimitrov answer that we can\'t use Url helper like $.ajax({ url: \'@Url.Action(\"Index\")\', . . . in sepa

6条回答
  •  感情败类
    2020-12-15 06:53

    Take a look at Generating External JavaScript Files Using Partial Razor Views. In this blog post, I describe how you can make use of regular Razor views and a custom action filter to render external JavaScript files that can have Razor code in them.

提交回复
热议问题