title: How to get the root path in JavaScript?
body: <p>I am using mod_rewrite to remap the URLs in my website in the following format:</p>
  <blockquote>
  <p><a href="http://www.mydomain.com/health/54856" rel="noreferrer">http://www.mydomain.com/health/54856</a></p>
  <p><a href="http://www.mydomain.com/economy/strategy/911025/" rel="noreferrer">http://www.mydomain.com/economy/strategy/911025/</a></p>
  <p><a href="http://www.mydomain.com/tags/obama/new" rel="noreferrer">http://www.mydomain.com/tags/obama/new</a></p>
  </blockquote>
  <p>The problem is that I am making AJAX calls to a file: <a href="http://www.mydomain.com/login.php" rel="noreferrer">http://www.mydomain.com/login.php</a></p>
  <p>And I don't want to write the FULL url or even use the <code>../</code> trick because there isn't a fixed level of folders.</p>
  <p>So, what i want is something to access the login.php from the root, whatever the domain name is:</p>
  <pre><code> $.ajax({
      type: &quot;POST&quot;,
      url: &quot;http://www.mydomain.com/login.php&quot;
   });
  </code></pre>