Last active
May 25, 2017 21:50
-
-
Save erogol/a0b10f7f82bc0b6f384b1c056a34685e to your computer and use it in GitHub Desktop.
This file contains hidden or 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 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