search_home.ejs
1.6 KB
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<html>
<head>
<title>전적 검색</title>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="search_home.css" />
<script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"></script>
<script src="https://code.jquery.com/jquery-1.11.3.min.js"></script>
</head>
<body>
<div id="main_frame">
<img class="box" id="left" src="metadata/image/wodi.png">
<img class="box2" id="right" src="metadata/image/sdao.png">
<div class="search" id="a">
<input type="text" id="name" placeholder="카트라이더 닉네임 입력" />
<button id="OK"></button>
</div>
</div>
</body>
<script>
$("#OK").click(function () {
var saveBtn=document.querySelector("#OK");
saveBtn.disabled=true;
$.ajax({
url: '/search',
async: true,
type: 'POST',
data: {
test: $("#name").val()
},
dataType: 'json',
success: function (data) {
if (data == "200") {
const div_target = document.querySelector('#a');
var obj = document.createElement('img');
obj.id = "loading";
obj.src = 'metadata/image/loading.gif';
div_target.append(obj);
window.location.href = "/search/result";
}
else {
swal("ERROR", "존재하지 않는 닉네임입니다.");
}
}
});
});
</script>
</html>