|
|
|
@ -12,89 +12,76 @@
|
|
|
|
min-height: 100vh;
|
|
|
|
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{
|
|
|
|
h1{
|
|
|
|
text-align: center;
|
|
|
|
|
|
|
|
color: white;
|
|
|
|
color: white;
|
|
|
|
text-shadow: 0 2px 5px rgba(150, 150, 150, 0.8);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#root {
|
|
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
p{
|
|
|
|
|
|
|
|
color:white;
|
|
|
|
.form {
|
|
|
|
|
|
|
|
width: 70%;
|
|
|
|
|
|
|
|
margin-bottom: 20px;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.container{
|
|
|
|
.form__button {
|
|
|
|
margin-left: 20vw;
|
|
|
|
text-align: center;
|
|
|
|
|
|
|
|
margin-top: 10px;
|
|
|
|
|
|
|
|
background-color: white;
|
|
|
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#submit{
|
|
|
|
#myButton {
|
|
|
|
margin-top: 20px;
|
|
|
|
box-sizing: border-box;
|
|
|
|
border-radius: 10px;
|
|
|
|
width: 100%;
|
|
|
|
height: 50px;
|
|
|
|
font-size: 18px;
|
|
|
|
width:50vw;
|
|
|
|
outline: none;
|
|
|
|
color:black;
|
|
|
|
border: none;
|
|
|
|
|
|
|
|
padding: 20px;
|
|
|
|
|
|
|
|
border-radius: 5px;
|
|
|
|
|
|
|
|
-webkit-transition: 0.3s;
|
|
|
|
|
|
|
|
-moz-transition: 0.3s;
|
|
|
|
|
|
|
|
transition: 0.3s;
|
|
|
|
|
|
|
|
-webkit-box-shadow: 0px 5px 5px 0px rgba(0, 0, 0, 0.1);
|
|
|
|
|
|
|
|
-moz-box-shadow: 0px 5px 5px 0px rgba(0, 0, 0, 0.1);
|
|
|
|
|
|
|
|
box-shadow: 0px 5px 5px 0px rgba(0, 0, 0, 0.1);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#inputText{
|
|
|
|
#myButton:hover {
|
|
|
|
border-radius: 10px;
|
|
|
|
-webkit-transition: 0.3s;
|
|
|
|
height: 30px;
|
|
|
|
-moz-transition: 0.3s;
|
|
|
|
width: 49.5vw;
|
|
|
|
transition: 0.3s;
|
|
|
|
|
|
|
|
-webkit-box-shadow: 0 5px 5px 0 rgba(0, 0, 0, 0.5);
|
|
|
|
|
|
|
|
-moz-box-shadow: 0 5px 5px 0 rgba(0, 0, 0, 0.5);
|
|
|
|
|
|
|
|
box-shadow: 0 5px 5px 0 rgba(0, 0, 0, 0.5);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.container_result{
|
|
|
|
#myResult {
|
|
|
|
margin-top: 20px;
|
|
|
|
|
|
|
|
min-height: 50px;
|
|
|
|
text-align: center;
|
|
|
|
text-align: center;
|
|
|
|
color: white;
|
|
|
|
width: 50vw;
|
|
|
|
text-shadow: 0 2px 5px rgba(150, 150, 150, 0.8);
|
|
|
|
border: 3px solid white;
|
|
|
|
|
|
|
|
border-radius: 5px;
|
|
|
|
|
|
|
|
background-color: grey;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</style>
|
|
|
|
</style>
|
|
|
|
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
|
|
|
|
|
|
|
</head>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<body>
|
|
|
|
<div>
|
|
|
|
<div class="container">
|
|
|
|
<h1>Знакомство с aiohttp</h1>
|
|
|
|
<h1>Знакомство с aiohttp</h1>
|
|
|
|
<div id="root">
|
|
|
|
<div id="root">
|
|
|
|
<div class="form">
|
|
|
|
<div class="form">
|
|
|
|
<div class="form__button">
|
|
|
|
<form id="myForm">
|
|
|
|
<button id='myButton'>Отправить</button>
|
|
|
|
<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>
|
|
|
|
</div>
|
|
|
|
<p id="myResult"></p>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</body>
|
|
|
|
</body>
|
|
|
|
<script>
|
|
|
|
<script>
|
|
|
|
$(document).ready(function () {
|
|
|
|
document.getElementById('myForm').addEventListener('submit', async function(event) {
|
|
|
|
$("#myButton").click(function () {
|
|
|
|
event.preventDefault(); // Предотвращаем отправку формы по умолчанию
|
|
|
|
$.ajax({
|
|
|
|
|
|
|
|
type: "POST",
|
|
|
|
const inputText = document.getElementById('inputText').value;
|
|
|
|
url: "/button-clicked",
|
|
|
|
|
|
|
|
dataType: "json",
|
|
|
|
const response = await fetch('/submit', {
|
|
|
|
success: function (response) {
|
|
|
|
method: 'POST',
|
|
|
|
$("#myResult").text(response.result);
|
|
|
|
headers: {
|
|
|
|
}
|
|
|
|
'Content-Type': 'application/x-www-form-urlencoded'
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
body: new URLSearchParams({
|
|
|
|
|
|
|
|
'text': inputText
|
|
|
|
|
|
|
|
})
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const responseText = await response.text();
|
|
|
|
|
|
|
|
document.getElementById('response').innerText = responseText;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
</script>
|
|
|
|
</html>
|
|
|
|
</html>
|
|
|
|
|