title: Alternative for url parameter in ajax when publish
body: <p>I am using a WEB API controller in my application, and I am using ajax to call that controller method.</p>
  
  <p>The url is:</p>
  
  <pre><code>url: "/api/Informations/" + link.attr("data-id")
  </code></pre>
  
  <p>This works perfectly on my local machine.</p>
  
  <p>The problem is when I publish.</p>
  
  <p>I have to change the URL to:</p>
  
  <pre><code>url: "ProjectNameOnServer/api/Informations/" + link.attr("data-id")
  </code></pre>
  
  <p>Is there a workaround for this?  Because if ever there were to be an issue concerning this, I would have to continuously change the url to test it on my local machine.. then when the issue is resolved.. change it back to the version where it works on the server.</p>
  
  <p>Any ideas on this?</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>Route for api :</p>
  
  <pre><code>config.Routes.MapHttpRoute(
      name: "DefaultApi",
      routeTemplate: "api/{controller}/{id}",
      defaults: new { id = RouteParameter.Optional }
  );
  </code></pre>