댓글 검색 목록

[javascript] 자바스크립트에서 json을 가져오는 방법

페이지 정보

작성자 운영자 작성일 17-12-23 11:02 조회 1,462 댓글 0

자바스크립트에서 json을 가져오는 방법

fetch('https://365ok.co.kr/dn/javascript/users.json')
.then(response => response.json())
.then(data => {
    console.log(data);
})
.catch(console.error);

결과


[{

    "id": 1,

    "name": "이순신"

}, {

    "id": 2,

    "name": "사임당"

}]


댓글목록 0

등록된 댓글이 없습니다.

웹학교 로고

온라인 코딩학교

코리아뉴스 2001 - , All right reserved.