ZRCola/ZRColaWS/test.html
Simon Rozman ff509ed6b5 ZRColaWS: Initial working version
Signed-off-by: Simon Rozman <simon@rozman.si>
2022-09-16 03:02:16 +02:00

46 lines
1.3 KiB
HTML

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="Content-Language" content="sl">
</head>
<style>
textarea, input[type="text"]
{
font-family: ZRCola;
font-size: 24px;
}
</style>
<body>
<form method="GET" name="about" action="http://localhost:8000/about">
<h1>about</h1>
<p><input type="submit" value="Submit"></p>
</form>
<form method="GET" name="transet" action="http://localhost:8000/transet">
<h1>transet</h1>
<p><input type="submit" value="Submit"></p>
</form>
<script type="text/javascript">
function submitJSON() {
var form = document.translate;
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function() {
if (xhr.readyState == XMLHttpRequest.DONE)
form["res"].value = xhr.responseText;
}
xhr.open("POST", "http://localhost:8000/translate", true);
xhr.setRequestHeader('Content-Type', 'application/json; charset=UTF-8');
xhr.send(form["req"].value);
}
</script>
<form name="translate">
<h1>translate</h1>
<p>
<textarea rows="10" name="req" cols="40">{"transet":[0], "text":"To je test."}</textarea>
>>
<textarea rows="10" name="res" cols="40"></textarea>
</p>
<p><input type="submit" value="Submit" onclick="submitJSON(); return false"><input type="reset" value="Reset"></p>
</form>
</body>