Reading JSON File
How to read a json file with JS function getData(){ console.log("inget Data function"); //Required parameters const method="GET"; const sync=true; const path="mok.json"; const request = new XMLHttpRequest(); request.open(method,path,sync); request.send(); request.onreadystatechange = function(){ if(this.readyState==4){ console.log(JSON.parse(request.responseText)); } } } Possible error could be CORS Access to XMLHttpRequest at from origin 'null' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https. To fix this on approach it by opening chrome disabling the web security: On OSX open -n -a /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --args --user-data-dir="/tmp/chrome_dev_test" --disable-web-security On Windows 10 C...