Edit:
Solved! For some reason, the CDN links given in the instructions do not work, but the ones in the codepen example do.
Tell us what’s happening:
Codesandbox Link: https://codesandbox.io/s/choropleth-map-io0lg?file=/src/index.js
I’m trying to load the two required JSON files for this project, but keep running into this error: “Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://cdn.freecodecamp.org/testable-projects-fcc/data/choropleth_map/counties.json. (Reason: CORS request did not succeed).”
Any help is appreciated!
Your code so far
import * as d3 from "d3";
const files = [
"https://cdn.freecodecamp.org/testable-projects-fcc/data/choropleth_map/counties.json",
"https://cdn.freecodecamp.org/testable-projects-fcc/data/choropleth_map/for_user_education.json"
];
let promises = [];
files.forEach(url => promises.push(d3.json(url)));
Promise.all(promises).then(data => console.log(data));
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:81.0) Gecko/20100101 Firefox/81.0
.
Challenge: Visualize Data with a Choropleth Map
Link to the challenge: