|
|
|
|
@ -10,11 +10,15 @@
|
|
|
|
|
|
|
|
|
|
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%)
|
|
|
|
|
background: linear-gradient(
|
|
|
|
|
90deg,
|
|
|
|
|
rgba(2, 0, 36, 1) 0%,
|
|
|
|
|
rgba(9, 9, 121, 1) 35%,
|
|
|
|
|
rgba(0, 212, 255, 1) 100%
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
h1 {
|
|
|
|
|
color: white;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
p {
|
|
|
|
|
color: white;
|
|
|
|
|
@ -43,8 +47,6 @@
|
|
|
|
|
border-radius: 5px;
|
|
|
|
|
background-color: grey;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</style>
|
|
|
|
|
</head>
|
|
|
|
|
<body>
|
|
|
|
|
@ -53,35 +55,41 @@
|
|
|
|
|
<div id="root">
|
|
|
|
|
<div class="form">
|
|
|
|
|
<form id="myForm">
|
|
|
|
|
<input type="text" id="inputText" placeholder="Введите текст">
|
|
|
|
|
<div class="form__button"><button id='submit'>Отправить</button></div>
|
|
|
|
|
|
|
|
|
|
<input type="text" id="inputText" placeholder="Введите текст" />
|
|
|
|
|
<div class="form__button">
|
|
|
|
|
<button id="submit">Отправить</button>
|
|
|
|
|
</div>
|
|
|
|
|
</form>
|
|
|
|
|
<div class="container_result">
|
|
|
|
|
<p id="response"></p>
|
|
|
|
|
</div>
|
|
|
|
|
<div>
|
|
|
|
|
<a href="/index_2.html">Перейти на страницу 2</a>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</body>
|
|
|
|
|
<script>
|
|
|
|
|
document.getElementById('myForm').addEventListener('submit', async function(event) {
|
|
|
|
|
document
|
|
|
|
|
.getElementById("myForm")
|
|
|
|
|
.addEventListener("submit", async function (event) {
|
|
|
|
|
event.preventDefault(); // Предотвращаем отправку формы по умолчанию
|
|
|
|
|
|
|
|
|
|
const inputText = document.getElementById('inputText').value;
|
|
|
|
|
const inputText = document.getElementById("inputText").value;
|
|
|
|
|
|
|
|
|
|
const response = await fetch('/submit', {
|
|
|
|
|
method: 'POST',
|
|
|
|
|
const response = await fetch("/submit", {
|
|
|
|
|
method: "POST",
|
|
|
|
|
headers: {
|
|
|
|
|
'Content-Type': 'application/x-www-form-urlencoded'
|
|
|
|
|
"Content-Type": "application/x-www-form-urlencoded",
|
|
|
|
|
},
|
|
|
|
|
body: new URLSearchParams({
|
|
|
|
|
'text': inputText
|
|
|
|
|
})
|
|
|
|
|
text: inputText,
|
|
|
|
|
}),
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const responseText = await response.text();
|
|
|
|
|
document.getElementById('response').innerText = responseText;
|
|
|
|
|
document.getElementById("response").innerText = responseText;
|
|
|
|
|
});
|
|
|
|
|
</script>
|
|
|
|
|
</html>
|
|
|
|
|
|