Will the above still work?
Not.
As far as I know, @ Url.Action will only work inside the Razor file
Your knowledge is correct.
But, given that we are encouraged to use unobtrusive JS, I'm not quite sure how I will use @ Url.Action.
You can use the HTML5 data- * attributes for some DOM element that you are unobtrusively improving (if this element is no longer a <form> or an anchor, in this case it already contains a URL):
<div id="foo" data-url="@Url.Action("foo")">Hello</div>
and then in your separate javascript file:
$(function() { $('#foo').click(function() { var url = $(this).data('url');
source share