In external js file, I cant use
url = \"@Url.Action(\"Action\", \"Controller\")\" //url output : @Url.Action(\"Action\", \"Controller\") //I get IllegalPat
You can use Hidden fields to do the same (on Master/Individual views).
View page:
@Html.Hidden("commonUrlTrack", Url.Action("Action_Method_Name", "Controller_Name")) Click Me
JS File:
function commonFunction() { var url = $("#commonUrlTrack").val(); alert(url); }