22.04.18(2) - Ajax


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 > 90) {
                          temp_html = `<li class="bad">${gu_name} : ${gu_mise}</li>`
                      } else {
                          temp_html = `<li>${gu_name} : ${gu_mise}</li>`
                      }

                      $('#names-q1').append(temp_html)
                  }
              }
            })
        }