-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathtest.html
More file actions
61 lines (58 loc) · 2.01 KB
/
test.html
File metadata and controls
61 lines (58 loc) · 2.01 KB
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
51
52
53
54
55
56
57
58
59
60
61
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Long Noodle Test</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js" type="text/javascript"></script>
<script src="./json2.js" type="text/javascript"></script>
<script src="./long_noodle.js" type="text/javascript"></script>
</head>
<body>
<h1>
Long Noodle Test
</h1>
<p>
This page uses jquery to long poll a server for message updates.
</p>
<p>
<b>Run this from terminal to post a text message:</b>
<br/>
<i>
curl '<span class='noodle_url'></span>?token=<span class='noodle_token'></span>' -d 'your message here'
</i>
</p>
<p>
<b>Run this from terminal to post a json message:</b>
<br/>
<i>
curl '<span class='noodle_url'></span>?token=<span class='noodle_token'></span>&dataType=json' -d '{body: "your message here"}'
</i>
</p>
<p>
<b>Messages:</b>
</p>
<p>
<div id="messages"></div>
</p>
<script type="text/javascript">
var url = "http://long-noodle.herokuapp.com/test_message";
var token = "NOODLE";
<!-- update the help text above -->
$('.noodle_url').html( url );
$('.noodle_token').html( token );
<!-- create the noodle object and start it -->
function startNoodling() {
(new LongNoodle(url, function(data) {
$('#messages').html(data.version + ': ' +
(data.json ? '<i>json:</i> '+JSON.stringify(data.json) : data.body) +
' <b>' + data.createdAt + '</b>' +
'<br/>' + $('#messages').html());
})).start();
}
<!-- don't start noddling until after the page loads so the spinny stops -->
$(document).ready(function() {
setTimeout( startNoodling, 1000);
});
</script>
</body>
</html>