Looking to build a work-around of the following.
$.getJSON(\'myfile.json\', function (data) {
showAll(data);
});
I want to avoid using a we
If you have a permission correctly, you can get the file using tag.
in html:
in favs.js:
var favs = [
{ url: 'http://google.com' },
{ url: 'http://stackoverflow.com' }
];
in script.js:
console.log(favs); // you can use favs as global variables
Otherwise, if you want to use ajax call such as $.getJSON(), you should have a webserver somehow.
Additionally, you can load js file dynamically. May you can use the code below for example:
function loadScript(path, onload) {
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = path;
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(script, s);
if(onload) s.onload = onload;
}