-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
26 lines (26 loc) · 826 Bytes
/
Copy pathscript.js
File metadata and controls
26 lines (26 loc) · 826 Bytes
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
$("#submit").click(function () {
let nmCity = $("#cityName").val();
console.log(nmCity);
$.ajax({
url: `http://api.weatherapi.com/v1/current.json?key=de5f8b0f21f64fdd8b2205228221406&q=${nmCity}`,
type: "GET",
success: function (dado) {
$(".city").text(dado.location.name + ", " + dado.location.region);
$(".icon").attr("src", dado.current.condition.icon);
$(".icon").css({
display: "inline",
});
$(".temp").text(dado.current.temp_c + " ºC");
$(".precProb").text(
"Precipitação prevista: " + dado.current.precip_mm + " mm"
);
$(".wind").text(
"Velocidade do vento: " + dado.current.wind_kph + " km/h"
);
$(".obsNote").css("display", "none");
},
error: function (error) {
console.log(error);
},
});
});