Fixed and reworked test-html file.

This commit is contained in:
Skayo
2018-05-01 01:37:53 +02:00
parent bf769feb4b
commit 8df812cb59
2 changed files with 26 additions and 6 deletions

2
.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
Werwolf.exe
werwolf

View File

@@ -1,15 +1,21 @@
<!DOCTYPE HTML>
<html> <html>
<head> <head>
<title>Werwolf Test page</title> <title>Werwolf Test page</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<style>
input {
width: 100%;
}
</style>
<script> <script>
function send(input, where) function send(input, where, server)
{ {
jQuery.post("http://127.0.0.1:25566/"+where, input, function(data, textStatus, jqXHR ){console.log(data);}); jQuery.post(server+where, input, function(data, textStatus, jqXHR ){console.log(data); $("#output").html($("#output").html()+JSON.stringify(data)+"<br/>");});
} }
$("document").ready(function(){ $("document").ready(function(){
$("#send").click(send($("#in").val(),$("#where").val())); $("#send").click(function() {send($("#in").val(),$("#where").val(),$("#server").val())});
}); });
</script> </script>
</head> </head>
@@ -18,11 +24,23 @@
</header> </header>
<main> <main>
<div style="border:1px solid black; background-color: grey; width: 300px; margin: auto; padding: 10px; border-radius: 10px;">
<h3 style="margin:0px; text-align: center;">Send JSON to Server-Path</h3>
<hr style="width: 320px; padding: 0px; margin-right: -10px; margin-left: -10px; border: none; background-color: black; height: 1px;" />
<form> <form>
<input id="in"/> <table style="width: 100%;">
<input id="where"/> <tr><td style="width: 33%; vertical-align: top;"><label>JSON:</label></td><td><textarea id="in" style="width: 100%; min-height: 100px;"></textarea></td></tr>
<button id="send">SEND</button> <tr><td><label>Send to path:</label></td><td><input id="where"/></td></tr>
<tr><td><label>Server:</label></td><td><input id="server" value="http://127.0.0.1:25566/"/></td></tr>
</table>
<button type="button" id="send" style="margin: auto; width: 100%;">SEND</button>
</form> </form>
</div>
<div style="border:1px solid black; background-color: grey; width: 300px; margin: auto; margin-top: 10px; padding: 10px; border-radius: 10px;">
<h3 style="margin:0px; text-align: center;">Answer:</h3>
<hr style="width: 320px; padding: 0px; margin-right: -10px; margin-left: -10px; border: none; background-color: black; height: 1px;" />
<p id="output"></p>
</div>
</main> </main>
<footer> <footer>