728x90
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css"
integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"
integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q"
crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"
integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl"
crossorigin="anonymous"></script>
<title>스파르타코딩클럽 | 부트스트랩 연습하기</title>
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Stylish&display=swap" rel="stylesheet">
<style>
*{
font-family: 'Stylish', sans-serif;
}
.candle{
width: 600px;
margin: auto auto 30px auto;
}
.image{
width: 600px;
margin: auto auto 30px auto;
display: block;
}
.mybtn{
background-color: dodgerblue;
margin: auto;
padding: 5px 20px 5px 20px;
display: block;
border-radius: 5px;
}
.hy{
color: blue;
}
</style>
<script>
$(document).ready(function () {
q1()
})
function q1() {
$.ajax({
type: "GET",
url: "https://api.manana.kr/exchange/rate.json",
data: {},
success: function (response) {
let hwan = response[1]['hy'];
$("#hwan").text(hwan);
}
})
}
function order(){
alert('주문이 접수되었습니다.');
}
</script>
</head>
<body>
<div class="candle" >
<img class="image" src="https://cdn.shopify.com/s/files/1/1357/3647/products/81BIBA8o-qL._SL1500_1024x1024.jpg?v=1505804281" />
<h1><span style="font-weight: bold">양초를 팝니다 <span style="font-size: medium">가격 : 3000원/개</span></span></h1>
<h5>이 양초는 사실 특별한 힘을 가지고 있어요. 양초를 켜고 소원을 빌면 짜자잔 뭐든지 이뤄지게 된답니다. 하나 사가세요! 대나무 향이 아주 좋아요</h5>
<p class = "hy">달러-원 환율: <span id="hwan">1134.25</p>
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text" id="basic-addon1">주문자 이름</span>
</div>
<input type="text" class="form-control" placeholder="" aria-label="Username"
aria-describedby="basic-addon1">
</div>
<div class="input-group mb-3">
<div class="input-group-prepend">
<label class="input-group-text" for="inputGroupSelect01">수량</label>
</div>
<select class="custom-select" id="inputGroupSelect01">
<option selected>--수량을 선택하세요--</option>
<option value="1">1개</option>
<option value="2">2개</option>
<option value="3">3개</option>
</select>
</div>
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text" id="basic-addon1">주소</span>
</div>
<input type="text" class="form-control" placeholder="" aria-label="Username"
aria-describedby="basic-addon1">
</div>
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text" id="basic-addon1">전화번호</span>
</div>
<input type="text" class="form-control" placeholder="" aria-label="Username"
aria-describedby="basic-addon1">
</div>
<button onclick="order()" class="mybtn"><span style="color: white">주문하기</span></button>
</div>
</body>
</html>
저번 숙제에서 달러환율을 넣는 문제인데 api에서 직접 값이 받아와지는게 아닌가?
답안 코드를 봤는데 거기에도 p태그 안에 숫자로 직접 쓰여있었다
728x90
LIST
'Study > 스파르타 코딩 클럽' 카테고리의 다른 글
3주차 수강 완료 (0) | 2021.06.27 |
---|---|
1주차 수강완료 (0) | 2021.06.13 |
왕초보 시작반 내일 찐 개강‼ (0) | 2021.06.06 |