When I write javascript code in ASP.NET MVC views, I can use @Url.Content() to generate a reference path.
Recently, I’m play with coffeescript and use MINDSCAPE Web WorkBench to generate js files in Visual Studio.
However, when I split all my js file to multiple files, I can’t use Url helpers so that I must hard code url path like ‘/Dashboard/User/12’ into coffee files.
Is there any work around that I can use url helpers in splited js/coffee files?
you can use html5
data-*attributes on html elements and from your js file you can access themHtml
Javascript
and that is the idea of unobtrusive Javascript ,put the needed information in the html document without putting Javascript code in it
if your using html helpers and want to use
data-*check this out