jquery, ajax 실습
<!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>2주차 숙제 | 김성필</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Stylish&display=swap" rel="stylesheet">
<style>
* {
font-family: 'Stylish', sans-serif;
}
.allwrap {
width: 800px;
margin: auto;
}
.topimage {
width: 800px;
height: 300px;
background-image: url("https://pelicana.co.kr/resources/images/menu/best_menu02_200824.jpg");
background-position: center;
background-size: cover;
margin-bottom: 20px;
}
.toptext {
margin-bottom: 10px;
}
.price {
font-size: medium;
}
.col-auto {
padding: 10px 0;
}
.submit {
margin: 10px auto 0 auto;
display: block;
}
#rate {
color: blue;
margin: 20px 0 10px 0;
font-size: 18px;
}
</style>
<script>
$(document).ready(function() {
$.ajax({
type: "GET",
url: "http://spartacodingclub.shop/sparta_api/rate",
data: {},
success: function (response) {
let rate = response["rate"]
$('#rate span').text(rate)
}
})
})
</script>
</head>
<body>
<div class="allwrap">
<div class="topimage"></div>
<div class="toptext">
<h1>치킨 판매 <span class="price">가격 : 20,000원/마리</span></h1>
<div>이 치킨은 아주 맛있습니다. 많이 많이 드셔보세요~</div>
</div>
<div id="rate">달러-원 환율 : <span></span></div>
<form>
<div class="col-auto">
<div class="input-group">
<div class="input-group-prepend">
<div class="input-group-text">주문자 이름</div>
</div>
<input type="text" class="form-control" id="inlineFormInputGroup" placeholder="">
</div>
</div>
<div class="col-auto">
<div class="input-group">
<div class="input-group-prepend">
<div class="input-group-text">수량</div>
</div>
<select class="custom-select">
<option selected>-- 수량을 선택하세요 --</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
</div>
</div>
<div class="col-auto">
<div class="input-group">
<div class="input-group-prepend">
<div class="input-group-text">전화번호</div>
</div>
<input type="text" class="form-control" id="inlineFormInputGroup" placeholder="">
</div>
</div>
<div class="col-auto">
<div class="input-group">
<div class="input-group-prepend">
<div class="input-group-text">주소</div>
</div>
<input type="text" class="form-control" id="inlineFormInputGroup" placeholder="">
</div>
</div>
<button type="submit" class="btn btn-primary submit">주문하기</button>
</form>
</div>
</body>
</html>
'Study' 카테고리의 다른 글
웹 개발 4주차 숙제 (0) | 2021.09.10 |
---|---|
웹 개발 3주차 숙제 (0) | 2021.09.05 |
웹 개발 1주차 숙제 (0) | 2021.08.16 |
MySQL workbench 처음 실행시 connections에 root가 없을 때 해결방법(Mac 사용자) (0) | 2021.03.28 |
vs code의 python 사용시 __init__ 자동입력 기능 문제 (0) | 2021.02.09 |
댓글