Fixed and reworked test-html file.
This commit is contained in:
30
index.html
30
index.html
@@ -1,15 +1,21 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Werwolf Test page</title>
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
|
||||
<style>
|
||||
input {
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
<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(){
|
||||
$("#send").click(send($("#in").val(),$("#where").val()));
|
||||
$("#send").click(function() {send($("#in").val(),$("#where").val(),$("#server").val())});
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
@@ -18,11 +24,23 @@
|
||||
|
||||
</header>
|
||||
<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>
|
||||
<input id="in"/>
|
||||
<input id="where"/>
|
||||
<button id="send">SEND</button>
|
||||
<table style="width: 100%;">
|
||||
<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>
|
||||
<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>
|
||||
</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>
|
||||
<footer>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user