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.
I have a getjson.html file containing the following code
<html>
<head>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("button").click(function(){
$.getJSON("json_data.txt",function(result){
$.each(result, function(i, field){
$("div").append(field + " ");
});
});
});
});
</script>
</head>
<body>
<button>Get JSON data</button>
<div></div>
</body>
</html>
The json_data.txt contains the following,
{
"firstName": "John",
"lastName": "Doe",
"age": 25
}
When I open the getjson.html file in the browser, it gives an error:
"XMLHttpRequest cannot load file://..... Origin null is not allowed by Access-Control-Allow-Origin."
Someone Please suggest a simple solution regarding this about how could I make this thing possible.
P.S: I am writing a web app on go.