XMLHttpRequest cannot load file://... Origin null is not allowed by Access-Control-Allow-Origin
<p>I see that the above question was asked earlier, however even after referring them I wasn't able to figure out a way for me, hence I took the liberty to start a new post for this question.</p>

<p>I have a getjson.html file containing the following code</p>

<pre><code>&lt;html&gt;
&lt;head&gt;
&lt;script type="text/javascript" src="jquery.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript"&gt;
$(document).ready(function(){
  $("button").click(function(){
    $.getJSON("json_data.txt",function(result){
      $.each(result, function(i, field){
        $("div").append(field + " ");
      });
    });
  });
});
&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;

&lt;button&gt;Get JSON data&lt;/button&gt;
&lt;div&gt;&lt;/div&gt;

&lt;/body&gt;
&lt;/html&gt;
</code></pre>

<p>The json_data.txt contains the following,</p>

<pre><code>{ 
  "firstName": "John",
  "lastName": "Doe",
  "age": 25
}
</code></pre>

<p>When I open the getjson.html file in the browser, it gives an error:</p>

<blockquote>
  <p>"XMLHttpRequest cannot load file://.....  Origin null is not allowed by Access-Control-Allow-Origin."</p>
</blockquote>

<p>Someone Please suggest a simple solution regarding this about how could I make this thing possible.</p>

<p>P.S: I am writing a web app on go.</p>
