Search based on temperature using OpenWeatherMap API -
i trying use openweathermap api to provide complete list of locations who's current temperature greater value.
after visiting documentation page came upon parameters "main.temp_min" , "main.temp_max". have examples using these parameters?
here's i've tried far.
$(document).ready(function(){ function displaylocationinfo(){ //variables var apikey = "----------"; var city = $("#location-input").val(); console.log(city) //search query var queryurl = "http://api.openweathermap.org/data/2.5/weather?q=" + city + "&units=imperial&appid=" + apikey; //find places hotter query // here run our ajax call openweathermap api $.ajax({url: queryurl, method: 'get'}) // store of retrieved data inside of object called "response" .done(function(response) { // log queryurl console.log(queryurl); // log resulting object console.log(response); // transfer content html $('.name').html("<h1>somewhere warm</h1>"); $(".wind").html("wind speed: " + response.wind.speed); $(".humidity").html("humidity: " + response.main.humidity); $(".temp").html("temperature (f) " + response.main.temp); // log data in console console.log("wind speed: " + response.wind.speed); console.log("humidity: " + response.main.humidity); console.log("temperature (f): " + response.main.temp); }); return false; }; $(document).on('click', '#searchbutton', displaylocationinfo); });
Comments
Post a Comment