What The Best Way To Handle Server Side Tags Inside Of A Js File?
I'm using Asp.NET MVC and have a huge dependency on JQuery throughout my entire application (not sure if that's important here or not). I'm trying to build a set of js library file
Solution 1:
You can put the base url in your view, and reference it from your js files
// site.mastervar appPath = <%=ResolveUrl("~/")%>;
// *.jsfunction dosomething()
{
var src = appPath + "content/images/test.png";
var action = appPath + "controller/action";
}
Note: this method requires that you write your action urls manually instead of calling Url.Action()
.
Post a Comment for "What The Best Way To Handle Server Side Tags Inside Of A Js File?"