title: Correct way to referencing paths in a Javascript file in an ASP.NET MVC app
body: <p>Currently what I'm doing in my js file is this (and it works):</p>
  
  <pre><code>    var root = "http://mydomain.com";
  
  $.ajax({
      type: "POST",
      url: root + "/MyController/MyAction",
      data: { 'id': myId },
      dataType: "html",
      success: function (response) {
      blah blah...
  </code></pre>
  
  <p>However the problem is if someone types in www.mydomain.com instead of mydomain.com, the path is not found.  I tried following the advice in this post: <a href="https://stackoverflow.com/questions/342364/relative-image-url-in-javascript-file-asp-net-mvc-and-iis-7">Relative Image URL in Javascript File - ASP.net MVC and IIS 7</a>, namely setting root to ../ or document.location.host, but both don't work.</p>
  
  <p>What's the correct way to specify paths (to actions in controllers, images, etc) in a js file?</p>
  
  <p>Thanks.</p>