I want to test locally (file:///
protocol) js that loads dynamically json file, based on the name in the url query-param.
I'm using chrome
file:///Users/eladb/Downloads/map/map_tmp.html?jsonPath=routes_2.json
I tried this:
var jsonPath = getParameterByName('jsonPath');
$.getJSON(jsonPath, function(json) {
console.log(json); // this will show the info it in firebug console
});
and got this error:
jquery.min.js:4 XMLHttpRequest cannot load file:///Users/eladb/Downloads/map/routes_2.json?_=1454238808580. Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https, chrome-extension-resource.
Is there a quick way to create a local server (mac, java) for testing only?