I am trying to load a json file into a table, after doing a lot of research I found solutions on how to do it.
But I am getting the below error on Chrome
XMLHttpRequest cannot load ... Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https, chrome-extension-resource.
Please suggest how I can avoid this error while loading my json data in chrome.
<script type="text/javascript">
$(function() {
$.getJSON('./files.json')
.success(function(data) {
var tr;
for (var i = 0; i < data.length; i++) {
tr = $('<tr/>');
tr.append("<td>" + data[i][0] + "</td>");
tr.append("<td>" + data[i][1] + "</td>");
$('#table1').append(tr);
}
})
.error(function(e) { console.error(e); })
});
</script>
Here is the HTML that I am loading the data into Name Path