title: How to use a relative path for (jquery) ajax url
body: <p>I have an ajax function:</p>
  
  <p><code>$.post("/ajax.php",{query:data},function(result){...</code></p>
  
  <p>the location of <code>ajax.php</code> is in the root of my domain (i.e. site.com/ajax.php)</p>
  
  <p>this same script gets called when the user is in a folder (i.e. site.com/m/)</p>
  
  <p>The problem I face is that I want to reference the root directory. Usually <code>/file.php</code> refers to the home directory as opposed to <code>file.php</code>. </p>
  
  <p>My requests are being sent to <code>http://site.com/m/ajax.php</code>. </p>
  
  <p>Does anyone know what I should do?</p>