-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathinput.html
87 lines (78 loc) · 1.9 KB
/
input.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<!DOCTYPE html>
<html>
<head>
<script src = "http://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script type = "text/javascript" src = "pubg.js"></script>
<style>
div.input{
position: absolute;
top: 300px;
left: 550px;
width: 300px;
height: 300px;
font-size: : 500px;
}
body {
background-size: cover;
}
#submit {
height: 30px;
background: gray;
cursor: pointer;
width: 100px;
text-align: center;
padding-top: 10px;
display: inline-block;
}
</style>
<title>Project PUBG</title>
<script>
$(document).ready(function(){
// ajax call when search button is clicked
$("#submit").click(function(){
username = $("#username").val();
// send input username to pubg.js
$.ajax({
type: "POST",
url: 'http://127.0.0.1:9091',
data: '{"nickname":' + "'" + username + "'" + ' }'
});
// send input username to select.php
$.ajax({
type: "POST",
url: "select.php",
data: {"nickname": username},
success: function(response, status){
console.log(response);
console.log(JSON.parse(response));
display(JSON.parse(response));
}
});
});
});
// response is object that contains query result
// not using status
function display(response){
var url = "";
var index = 1;
$.each(response, function(key, value){
url += key + "=" + value;
index++;
if(index != response.length){
url += "&";
}
})
window.open('display.php?' + url);
}
//in display.php use $_GET to get data from here
</script>
</head>
<body background= "css/pubg.jpg">
<div class = "input">
<form>
<input type = "text" id="username" name = "username" placeholder = "Enter your PUBG name" style = "height: 50px" />
<span id = "submit">search</span>
</form>
</div>
</body>
</html>