parent
6d84c0d11d
commit
80e7b59fe3
@ -0,0 +1,15 @@
|
||||
<head>
|
||||
<script src="https://code.jquery.com/jquery-3.4.1.min.js"
|
||||
integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous">
|
||||
</script>
|
||||
<script src="./index.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<title>Debug</title>
|
||||
<input type="text" id="location" /> <input type="button" value="send" onclick="send()" /><input type="button" value="get" onclick="get()" />
|
||||
</br>
|
||||
<input type="text" id="name" value="Name" />
|
||||
<input type="text" id="ownerID" value="ownerID" />
|
||||
<input type="text" id="gameID" value="gameID" />
|
||||
<input type="text" id="seats" value="seats" />
|
||||
</body>
|
@ -0,0 +1,30 @@
|
||||
url="http://127.0.0.1:3000"
|
||||
|
||||
function send() {
|
||||
data = {name: $('#name').val(), ownerID: $("#ownerID").val(), gameID: $("#gameID").val(), seats: $("#seats").val()}
|
||||
console.log(JSON.stringify(data))
|
||||
let xhr = new XMLHttpRequest();
|
||||
xhr.open("POST", url + "/" + $('#location').val(), true)
|
||||
xhr.setRequestHeader('Content-Type', 'application/json');
|
||||
xhr.onreadystatechange = function () {
|
||||
if (xhr.readyState == 4 && xhr.status == 200) {
|
||||
|
||||
console.log(JSON.parse(xhr.responseText))
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
xhr.send(JSON.stringify(data))
|
||||
}
|
||||
|
||||
function get() {
|
||||
let xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", url + "/" + $('#location').val(), true)
|
||||
xhr.setRequestHeader('Content-Type', 'application/json');
|
||||
xhr.onreadystatechange = function () {
|
||||
if (xhr.readyState == 4 && xhr.status == 200) {
|
||||
console.log(JSON.parse(xhr.responseText))
|
||||
}
|
||||
}
|
||||
xhr.send()
|
||||
}
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in new issue