For my school project, I decided to create a weather website using the Wunderground Weather API. Below is the code snippet I'm utilizing to access the JSON data:
$.getJSON("http://api.wunderground.com/api/<apikey>/conditions/q/" + wlocation + ".json", function(data){
alert(data);
});
The <apikey>
serves as a placeholder for my unique API key, and the $
symbol signifies JQuery in this context.
Upon attempting to load the webpage locally, without publishing it, no alert appears and an error message is generated:
XMLHttpRequest cannot load http://api.wunderground.com/api/<apikey>/conditions/q/<myzipcode>.json. Origin null is not allowed by Access-Control-Allow-Origin.
After conducting some research on resolving this issue, it seems that setting up a web server might be necessary. However, since our project needs to be submitted as a folder containing .html and other related files, I am unsure if there is an alternative method. Time is of the essence with the deadline approaching, so any guidance would be greatly appreciated!