본문 바로가기
풀스택 개발일지

[웹개발 종합반 2주차] 2주차 숙제

by 노랑사랑팽이 2022. 10. 21.

🔖현재 날씨 서버에서 받아와서 표시해주기

🔎 날씨 OpenAPI

http://spartacodingclub.shop/sparta_api/weather/seoul

 

🔎 로딩 후 호출하기

$(document).ready(function(){
	alert('다 로딩됐다!')
});

 

🔎 Head

<script>
$(document).ready(function () {
  $.ajax({
    type: "GET",
    url: "http://spartacodingclub.shop/sparta_api/weather/seoul",
    data: {},
    success: function (response) {
      let temp = response['temp']
      $('#temp').text(temp)
    }
  })
});
</script>

 

🔎 Body

<p>현재 기온 : <span id="temp">00.0</span>도</p>

특정 값만 변경하고 싶으면 span태그를 쓴다.

 


☀️ 느낀점

숙제가 엄청 쉽게 풀렸다. 앞으로의 숙제도 이렇게 쉬웠으면 좋겠지만, 난 어렵다는 걸 알아서...ㅎㅎㅎ

주말에 알고리즘공부를 하기 위해선 오늘 최대한 달려야 겠다. 3주차까지 마루리해야한다. 오후에도 최대한 수강해야겠다.

댓글