title: Ajax call from rewritten url
body: <p>I'm trying to make an ajax call from within a page with a rewritten URL.</p>
  
  <pre><code>request = $.ajax({
                  url: "myajaxcode.php",
                  type: "post",
                  data: formData
              });
  </code></pre>
  
  <p>The resulting request is <code>.../Folder/Rewritten_Name/myajaxcode.php</code></p>
  
  <p>For this to work the url should be <code>.../Folder/myajaxcode.php</code></p>
  
  <p>I also tried using a backslash in the url: "/myajaxcode.php", this resolves to 
      <code>/myajaxcode.php</code></p>
  
  <p>The ajax works when I provide the absolute URL or if I use a function that calculates and base URL and prefixes it the php file name. However, ideally I wanted to avoid using absolute urls or additional functions.</p>
  
  <p>Is there a better way of handling the ajax call?</p>
  
  <p>My htaccess is</p>
  
  <pre><code>RewriteEngine on
  RewriteBase /Folder/
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  
  RewriteRule ^Rewritten_Name/([^/]+) Rewritten_Name.php?r=$1
  </code></pre>