34 lines
869 B
HTML
34 lines
869 B
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<title>Chat</title>
|
|
</head>
|
|
<body>
|
|
<form action="/send">
|
|
<label for="nickname">Nickname: </label><br>
|
|
<input type="text" id="nickname" name="nickname"><br>
|
|
<label for="message">Message: </label><br>
|
|
<textarea id="message" name="message" rows="5" cols="50"></textarea><br>
|
|
<button id="submit" type="submit">Submit</button>
|
|
</form>
|
|
Messages:
|
|
<hr>
|
|
<div id="messages">
|
|
{{messages|safe}}
|
|
</div>
|
|
<script>
|
|
function getMessages() {
|
|
const xhttp = new XMLHttpRequest();
|
|
xhttp.onload = function() {
|
|
document.getElementById("messages").innerHTML = this.responseText;
|
|
}
|
|
xhttp.open("GET", "/getMessagesTable", true);
|
|
xhttp.send();
|
|
}
|
|
|
|
window.setInterval(() => {
|
|
getMessages();
|
|
}, 1000);
|
|
</script>
|
|
</body>
|
|
</html>
|