In external js file, I cant use
url = \"@Url.Action(\"Action\", \"Controller\")\"
//url output : @Url.Action(\"Action\", \"Controller\")
//I get IllegalPat
As .js files are not parsed by asp.net mvc view engine, you simply cannot use any c# code in there. I would suggest using unobtrusive approach, something like this
And in javascript, use value of data-request-url
$(function(){
$('#loader').click(function(){
var url = $(this).data('request-url');
alert(url);
});
});