i'd like to import this json file in my JavaScript (test.js) without using any server (Node or others).
i searched on google, but i couldn't the correct answer. when i used ajax, it need to allow CORS.
Access to XMLHttpRequest at file:/..../data.json' from origin 'null' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https.
data.json file is like this:
[
{
"id": 1,
"name": {
"first": "Paige",
"last": "Bools"
},
"marks": {
"math": 80.89,
"history": 78.23,
"computer": 68.09
}
},
]
in this case, how can i import this json file in my javascript file? please give me any suggestion.
https://example.com/data.json, then you can access it through the CORS-Anywhere service with this URL:https://cors-anywhere.herokuapp.com/https://example.com/data.json