title: Get proper root in javascript file
body: <p>I'm having a problem with resolving the root of a URL between my local machine and after deploying an application on IIS to our dev server.</p>
  
  <p>The url when running locally is something like this.
  <a href="http://localhost:57173/" rel="nofollow">http://localhost:57173/</a></p>
  
  <p>the url when running on the dev server is something like this.
  <a href="http://ServerName/AppName" rel="nofollow">http://ServerName/AppName</a></p>
  
  <p>I have JQuery Ajax calls to a web api and it won't find the location on the dev server if the trailing slash is left off.</p>
  
  <p>Here's the call</p>
  
  <pre><code>$.ajax({
      type: "GET",
          url: "api/MyApi/Get",
          data: { period: selectedPeriod },
          cache: false,
          success: function (data) {
  
          }
      });
  </code></pre>
  
  <p>If I look in FireBug at the api call on the dev server, with the trailing slash left off, it will show </p>
  
  <pre><code>http://ServerName/api/MyApi/Get
  </code></pre>
  
  <p>If I <strong>do</strong> have the trailing slash, it will resolve correctly to this.  (Notice the AppName now included.)</p>
  
  <pre><code>http://ServerName/AppName/api/MyApi/Get
  </code></pre>
  
  <p>What am I missing here?  It looks like it's not finding the proper root of the application when I move it to this server.  The trailing slash makes no difference locally.   It will find the api either way.  Any ideas how to resolve this?</p>