You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

96 lines
2.3 KiB

2 years ago
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Знакомство с aiohttp</title>
<style>
html {
font-family: Verdana, "sans-serif";
}
body {
min-height: 100vh;
background: linear-gradient(
90deg,
rgba(2, 0, 36, 1) 0%,
rgba(9, 9, 121, 1) 35%,
rgba(0, 212, 255, 1) 100%
);
2 years ago
}
h1 {
2 years ago
color: white;
}
p {
color: white;
2 years ago
}
.container {
2 years ago
margin-left: 20vw;
2 years ago
}
#submit {
2 years ago
margin-top: 20px;
border-radius: 10px;
height: 50px;
width: 50vw;
color: black;
2 years ago
}
#inputText {
2 years ago
border-radius: 10px;
height: 30px;
width: 49.5vw;
2 years ago
}
.container_result {
2 years ago
margin-top: 20px;
min-height: 50px;
2 years ago
text-align: center;
2 years ago
width: 50vw;
border: 3px solid white;
border-radius: 5px;
background-color: grey;
2 years ago
}
</style>
</head>
<body>
2 years ago
<div class="container">
2 years ago
<h1>Знакомство с aiohttp</h1>
<div id="root">
<div class="form">
2 years ago
<form id="myForm">
<input type="text" id="inputText" placeholder="Введите текст" />
<div class="form__button">
<button id="submit">Отправить</button>
</div>
2 years ago
</form>
<div class="container_result">
<p id="response"></p>
</div>
<div>
<a href="/index_2.html">Перейти на страницу 2</a>
</div>
2 years ago
</div>
</div>
2 years ago
</div>
2 years ago
</body>
<script>
document
.getElementById("myForm")
.addEventListener("submit", async function (event) {
event.preventDefault();
2 years ago
const inputText = document.getElementById("inputText").value;
2 years ago
const response = await fetch("/submit", {
method: "POST",
headers: {
"Content-Type": "application/x-www-form-urlencoded",
},
body: new URLSearchParams({
text: inputText,
}),
2 years ago
});
const responseText = await response.text();
document.getElementById("response").innerText = responseText;
});
</script>
2 years ago
</html>