title: read an external local JSON file into Javascript
body: <p>I am learning to read an external local JSON files into javascript. I follow the link below </p>
  
  <p><a href="https://stackoverflow.com/questions/19706046/how-to-read-an-external-local-json-file-in-javascript">How to read an external local JSON file in Javascript</a></p>
  
  <p>However, I am not able to make it.  I have a test.json in my C drive, which path is "c:\\test.json".  I think my program works like this: when the content in the local json file is updated, my program is going to alert the data in the json file.   I don't know what is wrong in my program. Hope someone could help me out.  Thank you in advance.     </p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
      &lt;meta charset="UTF-8"&gt;
      &lt;title&gt;noName&lt;/title&gt;
      &lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"&gt;&lt;/script&gt; 
      &lt;link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/themes/smoothness/jquery-ui.css"&gt;
      &lt;script type="text/javascript" src="test.json"&gt;&lt;/script&gt;
      &lt;script type="text/javascript" src="javascrip.js"&gt;&lt;/script&gt;
  &lt;/head&gt;
  
  
  &lt;script type="text/javascript"&gt;
  
      $(document).ready(function() {
          alert("goes here ");
          readTextFile("c:/test.json", function(text){
          var data = JSON.parse(text);
          alert(data);
      });
  });
  
  
  function readTextFile(file, callback) {
       var rawFile = new XMLHttpRequest();
       rawFile.overrideMimeType("application/json");
       rawFile.open("GET", file, true);
       rawFile.onreadystatechange = function() {
           if (rawFile.readyState === 4 &amp;&amp; rawFile.status == "200") {
               callback(rawFile.responseText);
           }
       };
       rawFile.send(null);
  }
  </code></pre>
  
  <p></p>
  
  <p></p>
  
  <p>test.json</p>
  
  <blockquote>
    <p>{"notes":["s0","s5","s4","s3","s2","s1"]}</p>
  </blockquote>