2024-12-30



<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<script type="text/javascript" src="https://code.jquery.com/jquery-3.7.1.js"></script>
<script type="text/javascript">
$(function() {
$.ajax({
type : "post",
url : "data/book.json",
dataType : "json",
success : function(result) {
$.each(result, function(i) {
let txt = "<tr><td>" + result[i].title + "</td>" +
"<td>" + result[i].author + "</td>" +
"<td>" + result[i].price + "</td></tr>";
$(".table_body").append(txt);
});
},
error : function() {
alert('데이터 통신 오류~~~')
}
});
});
</script>
</head>
<body>
<div align="center">
<h2>BOOK 리스트</h2>
<table border="1">
<thead>
<tr>
<th>책 제목</th>
<th>책 저자</th>
<th>책 가격</th>
</tr>
</thead>
<tbody class="table_body">
</tbody>
</table>
</div>
</body>
</html>
[
{
"title" : "혼자 공부하는 자바",
"author" : "신용권",
"price" : "28,000원"
},
{
"title" : "Do it! mySQL로 배우는 데이터베이스 입문",
"author" : "강성욱",
"price" : "25,000원"
},
{
"title" : "Do it! HTML + CSS3 웹 표준의 정석",
"author" : "고경희",
"price" : "26,000원"
},
{
"title" : "최범균의의 JSP 2.3 웹 프로그래밍",
"author" : "최범균",
"price" : "27,000원"
},
{
"title" : "코드로 배우는 스프링 웹 프로젝트",
"author" : "구멍가게 코딩단",
"price" : "38,000원"
}
]'JSP > 기초 내용 정리' 카테고리의 다른 글
| JSP(Ajax)_Join (0) | 2024.12.31 |
|---|---|
| JSP(Ajax)_04 (0) | 2024.12.31 |
| JSP(Ajax)_02 (0) | 2024.12.31 |
| JSP(Ajax)_01 (0) | 2024.12.31 |
| JSP(Ajax)_00 (1) | 2024.12.31 |