-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathmain.js
29 lines (22 loc) · 894 Bytes
/
main.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
27
28
29
$(document).ready(function(){
$('#btn').click(function(){
var city = $('#city').val();
//alert(city);
$('#temp').attr('style','"display: block;"')
//$('#result').attr('src',`http://api.openweathermap.org/data/2.5/forecast?q=${city}&units=metric&APPID=d04a2f7e083913ea5b3767657fbc6a38`);
var tempr = {
"async": true,
"crossDomain": true,
"url": `https://api.openweathermap.org/data/2.5/weather?q=${city}&units=metric&appid=d04a2f7e083913ea5b3767657fbc6a38`,
"method": "GET"
}
$.ajax(tempr).done(function (response) {
$(".temprature").empty();
var content = response.main.temp;
$(".temprature").append(content);
$(".humid").empty();
var humidity = response.main.humidity;
$(".humid").append(humidity);
});
});
});