web-smartme-powermeter/index.php

38 lines
1013 B
PHP
Raw Permalink Normal View History

2019-11-12 14:34:34 +01:00
<html>
<head>
<title>smart-me metrics by m.reber</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
</head>
<body>
<h1>Power stats</h1>
<div id="printPostResult"></div>
<script>
function sendRequest(){
$.ajax({
url: "get_smartme.php",
success:
// Perform operation on the return value
function(data){
$('#printPostResult').html(data); //insert text of get_smartme.php into the div
},
complete: function() {
// Schedule some stuff when the current operation is complete
}
});
};
// The ready-function is automaticly executed, when the site is fully loaded
$(document).ready(function(){
sendRequest(); // Execute the Function once per page load (To load the content from begining)
setInterval(sendRequest,6000); //Execute the Function after every 6 seconds.
});
</script>
</body>
</html>