I have been attempting to import a json file into a table, after conducting thorough research I finally discovered some solutions on how to achieve this.
However, when trying to implement it in Chrome, I encountered the following error:
XMLHttpRequest cannot load ... Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https, chrome-extension-resource.
I would appreciate any suggestions on how to prevent this error from occurring 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>
Below is the HTML code where I am attempting to incorporate the data: Name Path