title: JQuery AJAX cannot find a text file in the same directory
body: <p>I am trying to use jQuery AJAX to pull text from a text file called "randomtext.txt"in the same directory as the html file and place it inside a div with an id of ajax_div, upon the click of a button. However, this does not work.The browser cannot find the text file. I checked the browser log on chrome and I get this error:</p>
  
  <blockquote>
    <p>XMLHttpRequest cannot load file:///C:/xampp/htdocs/randomtext.txt. Received an invalid response. Origin 'null' is therefore not allowed access. </p>
  </blockquote>
  
  <p>Firefox logs this error:</p>
  
  <blockquote>
    <p>[20:07:55.847] syntax error @ file:///C:/xampp/htdocs/randomtext.txt:1
    [20:07:55.849] syntax error @ file:///C:/xampp/htdocs/jquery_ajax.html:1</p>
  </blockquote>
  
  <p>The following is my code:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
      &lt;script type="text/javascript" src ="jquery-2.0.3.js"&gt;&lt;/script&gt;
      &lt;script type="text/javascript"&gt;
          $(document).ready(function(){
              $("button#ajax_click").click(function() {
                  jQuery.ajax({url: "randomtext.txt",success: function(result) {$("div#ajax_div").html(result);}});
              });
          });
      &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;div id = "ajax_div"&gt;&lt;/div&gt;
      &lt;button id="ajax_click"&gt;Click me!&lt;/button&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>I've gone through other solutions such as putting in the entire file directory in place of the url, but to no avail.</p>
  
  <p>Thank You</p>