<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>example</title>
<script type="text/javascript" src="HTTP-client/jshttpclient.js"></script>
</head>
<body>
<div id="main"></div>
<button id="btn">10 clicks</button>
<a href="cgi-bin/rest.php" target="_blank">Reset clicks</a>
<script>
setInterval(function() {
var httpClient = new HTTPClient();
function CustomHTTPHandler() {
this.onInitializing = function() {
};
this.onerror = function(status, statusText) {
};
this.onprogress = function(responseText, contentLength) {
};
this.onFinally = function(result) {
c = document.getElementById("main");
c.innerHTML = result;
};
}
httpClient.customHTTPHandler = new CustomHTTPHandler();
httpClient.get('http://localhost/realtime_button/cgi-bin/exemple.php');
httpClient.next();
}, 2000);
function goes() {
var httpClient = new HTTPClient();
function CustomHTTPHandler() {
this.onInitializing = function() {
};
this.onerror = function(status, statusText) {
};
this.onprogress = function(responseText, contentLength) {
};
this.onFinally = function(result) {
c = document.getElementById("main");
c.innerHTML = result;
}
}
httpClient.customHTTPHandler = new CustomHTTPHandler();
var params= new HTTPParams();
params.add('i', 1);
httpClient.get('http://localhost/realtime_button/cgi-bin/exemple.php', params);
httpClient.next();
}
document.getElementById('btn').onclick = function() {goes();}
document.getElementById('rest').onclick = function() {
}
</script>
</body>
</html>