title: Jquery AJAX always errors
body: <p>I am using nginx web server and running a website on localhost.  I want to be able to get my files through the server with jquery's AJAX function but it always throws an error. I've made a folder called TESTFOLDER inside my 'data' folder and it has a txt file called test.txt.</p>
  
  <p>This is my javascript code</p>
  
  <pre><code>$.ajax({
    url: "../data/TESTFOLDER/",
    type: 'GET',
    dataType: "txt",
    headers: { 
      Accept : "text/html",
      "Content-Type": "text/html"
     },
    success: function(data){
      console.log('there was a success');
    },
    error: function (jqXHR, textStatus, errorThrown) {
          console.log('there was an error');
    }
  });
  </code></pre>
  
  <p>This is my nginx configuration block for the folder</p>
  
  <pre><code>    location /data/TESTFOLDER/ {
          autoindex on;
          try_files $uri $uri;
          add_header Content-Type application/txt;
      }
  </code></pre>
  
  <p>I always get this error:</p>
  
  <pre><code>NetworkError: 500 Internal Server Error
  </code></pre>
  
  <p>when it tries to reach the data/TESTFOLDER</p>
  
  <p>I have of course tried it simpler than this, without the headers and all that. Nothing seems to work though. Please help if you can.</p>
  
  <p>EDIT:</p>
  
  <ul>
  <li>Yes, I can get to the file by typing out local host/data/TESTFOLDER/test.txt in my browser.</li>
  <li>The ../ doesn't seem to be causing problems because in both cases, I get the error message 500 Internal Server Error - local host/data/TESTFOLDER/, i.e. not local host/../data/TESTFOLDER/</li>
  <li>The server error log says: 2020#2644: rewrite or internal redirection cycle while internally redirecting to "/data/TESTFOLDER/", client: 127.0.0.1, server: localhost, request: "GET /data/TESTFOLDER/ HTTP/1.1", host: "localhost", referrer: "http:// localhost/index.html"</li>
  </ul>
  
  <p>NOTE: The word local host is in two seperate words here because they won't allow me to post links. </p>
  
  <p>EDIT2: I should note that while local host/data/TESTFOLDER/test.txt works fine in my browser, local host/data/TESTFOLDER/ throws the error 500. Should this be happening?</p>