-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
35 lines (33 loc) · 1.21 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<html>
<head>
<script type="text/javascript"
src="js/jquery/jquery-1.8.2.min.js"></script>
<script type="text/javascript" language="javascript">
var interval_posting;
function postdata() {
var meter_id = $('[name="meter_id"]').val();
var posting = $.post('simulator2.php', {meter_id:meter_id});
posting.done(function (data) {
$('#log').append('<p>' + data + '</p>');
});
}
function start() {
interval_posting = window.setInterval(function(){postdata()}, 1000);
}
function stop() {
window.clearInterval(interval_posting);
}
$(function () {
$('#start').click(function(){start();});
$('#stop').click(function(){stop()});
})
</script>
</head>
<body>
<form id="startStop" action="simulator2.php" method="post">
ID do medidor: <input type="text" name="meter_id"><br>
<a id="start" href="#">Start</a>
<a id="stop" href="#">Stop</a>
</form>
</body>
</html>