title: Setting asp.net MVC4 web api route url in javascript is returning empty string
body: <p>Here is the code that I am using to set the api url:</p>
  
  <pre><code>var clientUrl = '@Url.RouteUrl("ApiControllerAction", new { httproute="", controller = "Client"})';
  </code></pre>
  
  <p>In my route.config the route looks like this:</p>
  
  <pre><code>routes.MapHttpRoute(
              name: "ApiControllerAction",
              routeTemplate: "api/{controller}/{action}/{id}"
          );
  </code></pre>
  
  <p>And the action on my controller that I am trying to hit is this:</p>
  
  <pre><code>[ActionName("clients")]
      public IQueryable&lt;Client&gt; GetClients(int id)
      {
          return Uow.Clients.GetClients(id);
      }
  </code></pre>
  
  <p>I have a function in javascript that is trying to hit this api, but I am getting a 404:</p>
  
  <pre><code>var getClients = function (id) {
              return $.ajax(clientUrl + "/clients/" + id)
          };
  </code></pre>
  
  <p>When I call getClients(1) the url is trying to hit is this:</p>
  
  <pre><code>localhost:12345/clients/1
  </code></pre>
  
  <p>Rather than my expected url of this:</p>
  
  <pre><code>localhost:12345/api/client/clients/1
  </code></pre>
  
  <p>Any idea where this is going wrong? I had this working in another project and can't remember if there is something else I am supposed to do. If I inspect the javascript the clientUrl = ''.</p>