-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpoll.html
More file actions
35 lines (32 loc) · 766 Bytes
/
poll.html
File metadata and controls
35 lines (32 loc) · 766 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
31
32
33
34
35
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>ReactPHP Long Poll Example</title>
<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
</head>
<body>
<h1>Results here</h1>
<ol id="results">
<!-- Results --->
</ol>
<script>
function longPoll() {
jQuery
.ajax('http://__SERVER_URL__/poll', {
type: "GET",
contentType: "text/plain",
xhrFields: {
withCredentials: true
},
crossDomain: true
})
.done(function (data) {
$('<li>' + data + '</li>').appendTo('#results');
longPoll();
});
}
longPoll();
</script>
</body>
</html>