스파르타 웹개발-2

Ye Seo Lee·2021년 7월 27일
0

스파르타

목록 보기
2/10

Ajax 자주쓰는 예제

$.ajax({
    type: "GET",
    url: "http://openapi.seoul.go.kr:8088/6d4d776b466c656533356a4b4b5872/json/RealtimeCityAir/1/99",
    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']
            if (gu_mise < 70) {
                console.log(gu_name,gu_mise)
            }
        }
    }
})

로딩 후 자동 실행

$(document).ready(function(){
    q1();
})

0개의 댓글