PythonController/templates/index.html

27 lines
925 B
HTML

<html>
<head></head>
<body>
<div class="slidecontainer">
<input type="range" min="0" max="100" value="0" class="slider" id="throttle">
<input type="range" min="-1" max="1" value="0" class="slider" id="direction">
</div>
</body>
<script>
var throttle_input = document.getElementById("throttle");
var direction_input = document.getElementById("direction");
function send_update() {
var xhr = new XMLHttpRequest();
xhr.open("POST", "/data", true);
xhr.setRequestHeader('Content-Type', 'application/json');
data = {
"throttle": throttle_input.value,
"direction": direction_input.value
}
xhr.send(JSON.stringify(data));
}
throttle_input.oninput = send_update
direction_input.oninput = send_update
</script>
</html>