forked from Mash-UP-BACKEND/backend7th
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
61 lines (58 loc) · 2.34 KB
/
index.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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<html>
<head>
<title>Backend 7기 자기소개</title>
<script
src="https://code.jquery.com/jquery-3.3.1.min.js"
integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8="
crossorigin="anonymous">
</script>
</head>
<body>
<h1>Backend 7기 자기소개</h1>
<form action="" method="GET">
<div>
<label for="name">이름: </label>
<input type="text" name="name"/>
<button type="submit">누구인가요?</button>
</div>
</form>
<h1 id="header"></h1>
<h2 id="introduce"></h2>
<div id="intro"></div>
<h2 id="talk"></h2>
<div id="talking"></div>
<script>
var header = document.getElementById("header");
var href = window.location.href;
var queryString = href.split('?');
if (1 < queryString.length) {
var splited = queryString[1].split('=');
if (1 < splited.length) {
var key = splited[0];
var value = splited[1];
var filename = value + ".json";
$.getJSON(filename, function(json) {
if(json["name"]){
header.innerText = json["name"];
introduce.innerText = "소개"
var intro = document.getElementById("intro");
intro.innerText = json["introduce"];
var talk = document.getElementById("talk");
talk.innerText = "하고 싶은 말";
var talking = document.getElementById("talking");
talking.innerText = json["talk"];
} else {
header.innerText = "이름을 입력해주세요";
}
}).fail(function(){
header.innerText = "자기소개가 없어요.";
});
} else {
header.innerText = "이름을 입력해 주세요";
}
}else{
header.innerText = "이름을 입력해주세요";
}
</script>
</body>
</html>