[2주차] ajax 시작하기

정우진·2022년 7월 16일
0

[주요내용]

  1. ajax 기본골격
    $.ajax({
    type: "GET",
    url: "여기에URL을입력",
    data: {},
    success: function(response){
    console.log(response)
    }
    })

[코드보기]

<script>
    $.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 mise = rows[i]['IDEX_MVL']
                console.log(gu_name, mise)
            }
        }
    })
profile
야하마 군산악기사 운영자

0개의 댓글