-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbook_api.html
30 lines (30 loc) · 950 Bytes
/
book_api.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>API 연습</title>
</head>
<body>
<h1>API 연습</h1>
<input id="search" type="text" />
<button id="submit">검색</button>
<br />
<script src="https://code.jquery.com/jquery-3.6.1.js" integrity="sha256-3zlB5s2uwoUzrXK3BT7AX3FyvojsraNFxCc2vC/7pNI=" crossorigin="anonymous"></script>
<script>
$("#submit").click(function(){
$.ajax({
method:"GET",
url: "https://dapi.kakao.com/v3/search/book?target=title&query=" + $("#search").val(),
headers: {Authorization: "KakaoAK 405a7fce7a43c5ca81d4eb78009752a8"}
})
.done(function(data){
console.log(data);
$("body").append("<span>"+data.documents[0].title+"</span>");
$("body").append("<img src=" + data.documents[0].thumbnail+"/>");
});
})
</script>
</body>
</html>