Skip to content
Snippets Groups Projects
Commit 32c31251 authored by 정 의찬's avatar 정 의찬
Browse files

add product.html

parent 66745727
No related branches found
No related tags found
No related merge requests found
......@@ -15,16 +15,13 @@ public class TestController {
public String test(@RequestParam("id") String id){
JsonObject obj = new JsonObject();
obj.addProperty("title", "산사와 아가싸");
obj.addProperty("content", "로맨틱 코메디");
JsonObject data = new JsonObject();
data.addProperty("time", "토일 8시");
obj.add("data", data);
obj.addProperty("item_nm", "수제 햄버거");
obj.addProperty("item_detail", "소고기 패티와 토마토가 들어 있는 햄버거");
obj.addProperty("item_reg_date", "2022/04/22");
obj.addProperty("item_price", "4000");
return obj.toString();
}
}
......@@ -31,7 +31,7 @@
<tr>
<td>COM001</td>
<td>REG02</td>
<td>커뮤니티 등록/td>
<td>커뮤니티 등록</td>
<td>커뮤니티 등록</td>
</tr>
</tbody>
......
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Product</title>
<link rel="stylesheet" href="/webjars/bootstrap/5.1.3/css/bootstrap.min.css">
<script src="/webjars/jquery/3.6.0/jquery.min.js"></script>
<script src="/webjars/popper.js/2.9.3/umd/popper.min.js"></script>
<script src="/webjars/bootstrap/5.1.3/js/bootstrap.min.js"></script>
<script>
$(document).ready(function(){
$("button").click(function(){
$.ajax({
type: 'GET',
url: '/test?id=1',
success: function(data){
var obj = JSON.parse(data);
$('#item_nm span').text(obj.item_nm)
$('#item_detail span').text(obj.item_detail)
$('#item_reg_date span').text(obj.item_reg_date)
$('#item_price span').text(obj.item_price)
}
});
});
});
</script>
</head>
<body>
<h1>상품 데이터 출력 예제</h1>
<div id = "item_nm">상품명: <span></span></div>
<div id = "item_detail">상품 상세설명: <span></span></div>
<div id = "item_reg_date">상품 등록일: <span></span></div>
<div id = "item_price">삼품가격: <span></span></div>
<button>조회</button>
</body>
</html>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment