add_fetch
This commit is contained in:
		
							parent
							
								
									01b5f88e31
								
							
						
					
					
						commit
						6718016a4d
					
				
							
								
								
									
										17
									
								
								index.html
									
									
									
									
									
								
							
							
						
						
									
										17
									
								
								index.html
									
									
									
									
									
								
							| @ -11,10 +11,23 @@ | ||||
| <body class="stackedit"> | ||||
|   <div class="stackedit__html"><h1 id="состояние-ардуины-отображается-в-браузере"><em>Состояние ардуины отображается в браузере:</em></h1> | ||||
| <h2 id="ответ-на-hello">ответ на “hello”</h2> | ||||
| <p>Пришел ответ:</p> | ||||
| <p>Пришел ответ: <span id="answer1"></span> </p> | ||||
| 
 | ||||
| <h2 id="состояние-ардуины-равно">Состояние ардуины равно</h2> | ||||
| <p>Пришел ответ:</p> | ||||
| <p>Пришел ответ:<span id="answer2"></span></p> | ||||
| </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> | ||||
| 
 | ||||
| </html> | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user