Now that you have moved everything to a separate js file, the file is treated as static content and the Razor syntax is not parsed.
If you need relative paths inside js that can change, you should include a script on every page that sets the var path, and use @ Url.Content (...) in this script, e.g.
<script type="text/javascript"> pathToAction = "@Url.Content(...)"; </script>
Then declare pathToAction var in your js file and use it as needed.
counsellorben
source share