Try to use the UrlHelper.RouteUrl method.
var xhr = $.ajax({
url: '@Url.RouteUrl("Default", new { controller = "Registers", action = "Test" })',
...
EDIT: To generate the path to the javascript file you could use another helper:
<script src="@Url.Content("~/admin/pos.js")"></script>
EDIT2 Your best and probably the only solution is to pass the url as the js function's argument
Your function in pos.js:
function MyFunction(url)
{
var xhr = $.ajax({
url: url,
...
}
and then call it from the cshtml like:
MyFunction('@Url.RouteUrl("Default", new { controller = "Registers", action = "Test" })');