강의 내용
API(통로)를 통해 정보 실시간 불러오기
<script>
$(document).ready(function(){
$.ajax({
type: "GET",
url: "http://spartacodingclub.shop/sparta_api/weather/seoul",
data: {},
success: function (response) {
let temp = response['temp']
let icon = response['icon'];
$('#temp').text(temp)
$('#wether').arrt('src',icon);
console.log(response);
}
})
})
</script>
...
jquery 사용하는 코드 확인
<body>
<div class="mytitle">
<h1>십센치(10cm) 팬명록</h1>
<p> 현재 기온 : <span id="temp">00.0</span>도 <image id="wether" src="http://openweathermap.org/img/w/01n.png"></image></p>
...
아이디 설정.