-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathajax.htm
More file actions
30 lines (29 loc) · 696 Bytes
/
ajax.htm
File metadata and controls
30 lines (29 loc) · 696 Bytes
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
<html>
<head>
<script src="jquery.min.js"></script>
<script>
setInterval("request()",500);
function request() {
$.post("display.php",
function(data){
document.getElementById("block").innerHTML = data;
});
}
function send(message) {
$.post("post.php", { msg: message },
function(data) {
if(data) {
alert("Message failed to send" + data);
}
});
}
</script>
</head>
<body>
<div id="update">
<input id=msg type="text" />
<input type="submit" value="Send" onclick="send(document.getElementById('msg').value);" />
</div>
<div id="block"></div>
</body>
</html>