- '์ ๋ฐ์ดํธ'๋ฅผ ๋๋ ์๋, ์ธ๋ถ์ ์๋ฃ๋ฅผ ์ ๋ฆฌํด์ ๋ณด์ฌ์ฃผ๊ธฐ
- ํ๋ฒ ๋ '์ ๋ฐ์ดํธ'๋ฅผ ๋๋ ์ ๋, ์ด์ ์๋ฃ๋ ์ญ์ ๋๊ณ ๋ค์ ๋ณด์ฌ์ฃผ๊ธฐ
<script>
function q1() {
$('#names-q1').empty()
$.ajax({
type: "GET",
url: "http://spartacodingclub.shop/sparta_api/seoulair",
data: {},
success: function (response) {
let rows = response["RealtimeCityAir"]["row"]
for (let i = 0; i < rows.length; i++) {
let gu_name = rows[i]["MSRSTE_NM"]
let gu_mise = rows[i]['IDEX_MVL']
let temp_html = ``
if (gu_mise > 60) {
temp_html = `<li class="bad">${gu_name} : ${gu_mise}</li>`
} else {
temp_html = `<li> ${gu_name} : ${gu_mise}</li>`
}
$('#names-q1').append(temp_html)
}
}
})
}
</script>