-
-
Save dewski/2512858 to your computer and use it in GitHub Desktop.
ad
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Dope</title> | |
<script src="http://code.jquery.com/jquery-1.7.2.min.js"></script> | |
<script type="text/javascript"> | |
$(function() { | |
var getPositions = function () { | |
return { | |
servo: $('#servo').val(), | |
position: $('#position').val() | |
} | |
}; | |
$('#position, #servo').change(function() { | |
var positions = getPositions() | |
var url = "url/servo.php?servo=" + positions.servo + "&position=" + positions.position; | |
$.get(url) | |
}) | |
$('#position').change(function() { | |
$(this).parent().find('span').text(getPositions().position) | |
}) | |
$('#servo').change(function() { | |
$(this).parent().find('span').text(getPositions().servo) | |
}) | |
}) | |
</script> | |
</head> | |
<body> | |
<p> | |
Servo: | |
<input name="servo" id="servo" type="range" min="0" max="5" value="0" step="1" style="width:75%; margin:100px auto;"> | |
<span>0</span> | |
</p> | |
<p> | |
Position: | |
<input name="position" id="position" type="range" min="0" max="180" value="0" step="1" style="width:75%; margin:100px auto;"> | |
<span>0</span> | |
</p> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment