- '์—…๋ฐ์ดํŠธ'๋ฅผ ๋ˆŒ๋ €์„๋•Œ, ์™ธ๋ถ€์˜ ์ž๋ฃŒ๋ฅผ ์ •๋ฆฌํ•ด์„œ ๋ณด์—ฌ์ฃผ๊ธฐ
- ํ•œ๋ฒˆ ๋” '์—…๋ฐ์ดํŠธ'๋ฅผ ๋ˆŒ๋ €์„ ๋•Œ, ์ด์ „์ž๋ฃŒ๋Š” ์‚ญ์ œ๋˜๊ณ  ๋‹ค์‹œ ๋ณด์—ฌ์ฃผ๊ธฐ

 

 

    <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>

+ Recent posts