0

So I found out the issue I am having is not uncommon. The problem is the fixes that I have seen require you to have access to both client and server side headers and through the IDE I don't think we have that.

let me start with the error I am getting:

ide50-jamesr1.cs50.io/:1 Failed to load https://ide50-jamesr1.cs50.io/articles?geo=02478: Redirect from 'https://ide50-jamesr1.cs50.io/articles?geo=02478' to 'https://cs50.io/_user_content/authorize?redirect=https%3A%2F%2Fide50-jamesr1.cs50.io%2Farticles%3Fgeo%3D02478' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://ide50-jamesr1.cs50.io:8080' is therefore not allowed access.

The related code is below:

marker.addListener('click', function(){
    $.getJSON("https://ide50-jamesr1.cs50.io/articles?geo=" + 
    place.postal_code, function(data){
       content = data;
    });
    info.setContent(content);
    info.open(map, marker);
});

I know I have a couple other things to fix before the JSON data can be correctly displayed via an infoWindow, but I need to first enable my code to fetch the data in the first place.

Let me know if you have any questions or need further details.

Thank you for your time and attention.

1 Answer 1

0

https://ide50-jamesr1.cs50.io and https://ide50-jamesr1.cs50.io:8080 use different ports, and therefore are considered different servers.

Instead of $.getJSON("https://ide50-jamesr1.cs50.io/articles?geo=" +, a relative path like $.getJSON("/articles?geo=" + should work.

1
  • @Blauef Thank you for the above! There is so much to learn, it is exciting! Now on to parsing the JSON so I am actually providing valid parameters! Commented Nov 16, 2017 at 11:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .