JSFiddle - React, Tailwind, and code Playground
by Julien Roy
HTML
<div id="loc">
</div>
<div id="temp">
</div>
<div id="fc">
</div>
JavaScript
const lat = 45;
const long = 5;
$.ajax({
url: "https://api.darksky.net/forecast/96dd30a49debe62a67b208f705e3d706/" + lat + "," + long,
dataType: "JSONP",
success: function(json) {
console.log(json);
$("#loc").html("Your location: " + json.latitude + "," + json.longitude);
$("#temp").html("Temperature: " + json.currently.temperature);
$("#fc").html("Test " + json.currently.summary);
},
error: function(xhr, status, error) {
console.log("error", status, xhr, error);
}
});