HansonServo/webpage.h

34 lines
854 B
C

const char* webpage = R"rawliteral(
<!DOCTYPE html>
<html>
<head>
<title>ESP32 HTTP Console</title>
<script>
function sendMessage() {
var msg = document.getElementById('message').value;
fetch('/send', {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
body: 'message=' + encodeURIComponent(msg)
})
.then(response => response.text())
.then(data => {
console.log(data);
document.getElementById('console').innerHTML += '<br>' + data;
})
.catch((error) => {
console.error('Error:', error);
});
}
</script>
</head>
<body>
<h1>ESP32 HTTP Console</h1>
<input id='message' type='text' placeholder='Type a message...'>
<button onclick='sendMessage()'>Send</button>
<div id='console' style='border:1px solid #000; height:200px; overflow:auto;'></div>
</body>
</html>
)rawliteral";