I’m working on the weather app now and I’m testing the waters w/ the code by using the below code:
$("#find_weather").click(function(){
$.get("https://fcc-weather-api.glitch.me/api/current?lat=35&lon=139", function(data, status){
console.log(data);
console.log(data[weather][id]);
console.log(data[weather][main]);
});
});
#find_weather is the id of a button in the HTML. The URL being used is the example latitude and longitude listed on the page that explains the API link. When I click the button while the website is in progress, at first it printed out the console.log(data); which was all that was inside the function at the time. However, when I debug the code now it skips over the get statement and the console returns this message:
Failed to load https://fcc-weather-api.glitch.me/api/current?lat=35&lon=139: No ‘Access-Control-Allow-Origin’ header is present on the requested resource. Origin is therefore not allowed access. The response had HTTP status code 503.
Any help is appreciated.