-
Notifications
You must be signed in to change notification settings - Fork 0
/
scripts.js
26 lines (23 loc) · 1.25 KB
/
scripts.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
$(".city-one").on("click", function(){
$.ajax({
url: "http://api.openweathermap.org/data/2.5/weather?q=LosAngeles,us&units=imperial&appid=e42d32af9555a899db7106b67e9e5aae",
method:"GET",
success: function(weatherData){
var descriptionEl = $("<div>");
descriptionEl.html("description: " + weatherData.weather[0].description + " , current temp: " + weatherData.main.temp + " , high temp: " + weatherData.main.temp_max + " , high temp: " + weatherData.main.temp_min + " , current wind speed: " + weatherData.wind.speed + " mph" + " sunrise: " );
$(".weather-display").html(descriptionEl);
}
});
});
$(".submit-button").on("click", function(){
var cityName = $("input").val();
$.ajax({
url: "http://api.openweathermap.org/data/2.5/weather?q=" + cityName + ",us&units=imperial&appid=e42d32af9555a899db7106b67e9e5aae",
method:"GET",
success: function(weatherData){
var descriptionEl = $("<div>");
descriptionEl.html("description: " + weatherData.weather[0].description + " , current temp: " + weatherData.main.temp + " , high temp: " + weatherData.main.temp_max + " , high temp: " + weatherData.main.temp_min + " , current wind speed: " + weatherData.wind.speed + " mph");
$(".weather-display").html(descriptionEl);
}
});
});