I been trying to use @Url.Action
inside Ajax url
in another external .JS
file but unfortunately i got no luck.
Here\'s my Cod
You can create a partial view, then inside this view are just list of hidden fields such as
@Html.Hidden("ActionName", @Url.Action("ActionName", "Controller"))
which generates this
then you can call it like
var urlAction = $('#ActioName').val();
or you can create a js function like what I did
function ActionCaller(actionName)
{
return $('#' + actionName).val();
}
var action = ActionCaller(ActionName);