add_fetch

This commit is contained in:
Иван Медведев 2023-05-24 19:19:06 +03:00
parent 01b5f88e31
commit 6718016a4d

View File

@ -11,10 +11,23 @@
<body class="stackedit"> <body class="stackedit">
<div class="stackedit__html"><h1 id="состояние-ардуины-отображается-в-браузере"><em>Состояние ардуины отображается в браузере:</em></h1> <div class="stackedit__html"><h1 id="состояние-ардуины-отображается-в-браузере"><em>Состояние ардуины отображается в браузере:</em></h1>
<h2 id="ответ-на-hello">ответ на “hello”</h2> <h2 id="ответ-на-hello">ответ на “hello”</h2>
<p>Пришел ответ:</p> <p>Пришел ответ: <span id="answer1"></span> </p>
<h2 id="состояние-ардуины-равно">Состояние ардуины равно</h2> <h2 id="состояние-ардуины-равно">Состояние ардуины равно</h2>
<p>Пришел ответ:</p> <p>Пришел ответ:<span id="answer2"></span></p>
</div> </div>
<script>
fetch('/hello') .then((response) => response.text())
.then((response) => {
const elem = document.getElementById("answer1");
elem.innerHTML = response;
});
fetch('/status') .then((response) => response.text())
.then((response) => {
const elem = document.getElementById("answer2");
elem.innerHTML = response;
});
</script>
</body> </body>
</html> </html>