-
Notifications
You must be signed in to change notification settings - Fork 0
/
get.html
50 lines (46 loc) · 1.11 KB
/
get.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
</head>
<script>
function poll() {
var a = 0;
console.log("poll top")
setTimeout(function () {
console.log("timeout 1");
var x = $.ajax({
type: 'GET',
url: 'http://ambience.herokuapp.com/Longpoll',
success: function (data) {
alert("works");
alert(data);
console.log(data);
},
error: function(xhr, textStatus, errorThrown){
console.log("statusText: " + xhr.statusText);
console.log("textStatus: " + textStatus);
console.log("errorThrown: " + errorThrown);
alert(errorThrown);
},
complete: poll
});
console.log("finish ajax");
console.log("a: " + a++);
}, 5000);
console.log("finish timeout");
};
console.log("line 29");
poll();
console.log("finished call to poll()")
// function poll() {
// var x = $.ajax({
// type: 'get',
// url : "http://ambience.herokuapp.com/Longpoll",
// success : function(data) {
// console.log(data);
// },
// dataType : "json",
// complete : poll
// });
// }
// poll();
</script>