Data Visualisation Data Visualization Projects - Visualize Data with a Bar Chart

Hi all,

This is going to seem like a rather silly question and not really assignment specific, but when using a GET request to access data stored on another webpage (like: https://raw.githubusercontent.com/freeCodeCamp/ProjectReferenceData/master/GDP-data.json), I am unable to access the data (my code is fine as I tried it on one of the freecodecamp tutorial pages) . Upon inspection, the issue is as follows “Indicate whether to send a cookie in a cross-site request by specifying its SameSite attribute” and " Resolve this issue by updating the attributes of the cookie:

  • Specify SameSite=None and Secure if the cookie should be sent in cross-site requests. This enables third-party use."

I understand this is a recent Chrome update and new requirement but how and where do I do this? In my own code? In my browser settings ?

Thanks J

Hi, can you share the code you are using to import your JSON data?

using codepen.io:

const req = new XMLHttpRequest();
req.open(
“GET”,
https://raw.githubusercontent.com/freeCodeCamp/ProjectReferenceData/master/GDP-data.json”,
true
);
req.send();
req.onload = function () {
var json = JSON.parse(req.responseText);
};

Seems to work fine for me on Chrome, using this:

const req = new XMLHttpRequest();
let json ={}
req.open(
  'GET',
  'https://raw.githubusercontent.com/freeCodeCamp/ProjectReferenceData/master/GDP-data.json',
  true
)
req.onload = () => {
  json = JSON.parse(req.responseText)
  console.log(json)
};
req.send();

What does it show in your console if you log ‘json’ like this?

It seems to be the same problem even with your modified code. It must have to do with my chrome cookie settings . I get the same message when I try to run it using Edge .

Chrome:

Edge:

Hi,
You are showing the ‘issues’ tab, can I see the ‘console’ tab, when you log the ‘json’ variable after importing it?

I have the same issues on Chrome, but it still loads the JSON data for me…

I can now get the json data to load

In the location bar on chrome, I had to enter chrome://flags to access the flag configuration and then set the following flags to enabled:

  • chrome://flags/#same-site-by-default-cookies
  • chrome://flags/#cookies-without-same-site-must-be-secure
1 Like