I'm looking to gather JSON data from the Open Weather Map API but have been running into trouble.
First, while running it using "file:///" I received a "Cross origin requests are only supported for protocol schemes..." error. Previous answers suggested running on a local server so I spun up a local node server and ran it again but received a "Get http://8080/404/url 404 not found" error.
Fairly new to all of this so any suggestions would be greatly appreciated.
var $url = "api.openweathermap.org/data/2.5/weather?";
$url += $.param({
"q": "London",
"units": "imperial",
"appid": "6cbde47ec63b876312c74a78055a5481",
"format": "json",
"callback": "?"
});
$.ajax({
url: $url,
dataType: "jsonp",
success: function(data) {
console.log("Working");
}
});
via pxr13
No comments:
Post a Comment