Skip to content

Instantly share code, notes, and snippets.

@erogol
Last active May 25, 2017 21:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save erogol/a0b10f7f82bc0b6f384b1c056a34685e to your computer and use it in GitHub Desktop.
Save erogol/a0b10f7f82bc0b6f384b1c056a34685e to your computer and use it in GitHub Desktop.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<!-- Be Mobile Friendly -->
<meta name="viewport" content="width=device-width,height=device-height initial-scale=1">
<title>TalkingRaspi</title>
<meta name="description" content="Talkingraspi interface">
<meta name="author" content="Eren Golge">
<link rel="stylesheet" href="css/styles.css?v=1.0">
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
<script>
// Sending start command to server
$(document).ready(function(){
$("#start_button").click(function(e){
e.preventDefault();
$.ajax({type: "POST",
url: "/start",
data: {},
success:function(result){
$("#start_button").html(result);
}});
});
});
// Sending stop command to server
$(document).ready(function(){
$("#stop_button").click(function(e){
e.preventDefault();
$.ajax({type: "POST",
url: "/stop",
data: {},
success:function(result){
$("#stop_button").html(result);
}});
});
// Checking system status
(function worker() {
$.ajax({
url: '/status',
success: function(data) {
$('#status_bar').html(data);
},
complete: function() {
// Schedule the next request when the current one's complete
setTimeout(worker, 5000);
}
});
})();
});
</script>
<!--[if lt IE 9]>
<script src="https://cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.js"></script>
<![endif]-->
</head>
<body>
<script src="js/scripts.js"></script>
<h1>Hi! This is Talkingraspi!</h1>
<span id="status_bar"></span>
</br>
</br>
<button id="start_button">Start Talkingraspi</button>
<button id="stop_button">Stop Talkingraspi</button>
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment