반응형
<scriptsrc="https://code.jquery.com/jquery-3.3.1.min.js"></script>
<script>
varobj = '{"name":"John", "age":30, "city":"New York"}';// json
$.ajax({
url:'https://api.ip.pe.kr/json/',
dataType:'json',
type:'get',
success:function(json){
//var test = JSON.parse(json);
console.log(json);
console.log(json.country_code);
}
});
</script>
결과

반응형
'js' 카테고리의 다른 글
ajax 즐겨찾기 버튼 만들기 (0) | 2021.03.23 |
---|---|
제이쿼리 html 함수 인자 싱글쿼테이션 사용.. (0) | 2021.03.12 |
ajax 리스트 불러와서 화면쏴주기 (0) | 2021.03.10 |
ajax로 데이터 가져와서 js, jQuery 로 tbody만들기 (0) | 2021.02.23 |
handlebar 예제 (0) | 2021.02.04 |
댓글