I'm having some trouble creating a complete application using an API, specifically the Forecast.io weather api. For simplicity, I've put my JS directly in my HTML page. For this basic version, I would be happy just to have this show something. Let's say I wanted current temperature (currently -> temperature). Also, I'm not sure if "?callback?" is always recommended for all RESTful APIs.
<!DOCTYPE html>
<html>
<body>
<p id="weather">Here's the weather:<p>
<button onclick="b()">Submit</button>
<script>
function b(){
var apiKey = '<private>';
var url = 'https://api.forecast.io/forecast/';
var lati = 0;
var longi = 0;
var data;
$.getJSON(url + apiKey + "/" + lati + "," + longi + "?callback=?", function(data) {
$('#weather').innerHTML('and the weather is: ' + data[4].temperature);
});
}
</script>
</body>
</html>