-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
104 lines (84 loc) · 3.43 KB
/
index.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<meta name="description" content=""/>
<meta name="keywords" content=""/>
<title>Telegram/Serverless Sample Site</title>
<link type="text/css" href="https://code.jquery.com/ui/1.12.1/themes/redmond/jquery-ui.css" rel="stylesheet"/>
<link href="https://maxcdn.bootstrapcdn.com/bootswatch/3.3.7/cerulean/bootstrap.min.css" rel="stylesheet" integrity="sha384-zF4BRsG/fLiTGfR9QL82DrilZxrwgY/+du4p/c7J72zZj+FLYq4zY00RylP9ZjiT" crossorigin="anonymous">
<link href='https://fonts.googleapis.com/css?family=Arvo:400,700' rel='stylesheet' type='text/css'>
<script>
function checkTime() {
$("#the_time").text("Asking the server for the time...");
$.get("/api/time", function(data) {
$("#the_time").text("The server sez the time is: " + data.message);
});
}
function sayHello() {
$("#the_greeting").text("Asking the server for the greeting...");
// post the message to the current site's /api/hello and it will
// be proxied to the serverless application
$.ajax({
'type': 'POST',
'url': "/api/hello",
'contentType': 'application/json',
'data': JSON.stringify({name: $("#your_name").val()}),
'dataType': 'json',
'success': function(data) {
$("#the_greeting").text("The server sez: "+data.message);
}
});
}
</script>
</head>
<body>
<nav class="navbar navbar-default">
<div class="container-fluid">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="https://telegr.am">
Home
</a>
</div>
</div><!-- /.container-fluid -->
</nav>
<div class="container">
<div class="content">
<div>
<div id="the_time"></div>
<button onclick="checkTime()">
Ask the server for the time
</button>
</div>
<hr>
<div>
<div id="the_greeting"></div>
<div>
Your Name:
<input id="your_name">
<br>
<button onclick="sayHello()">
Ask the server for a greeting
</button>
</div>
<hr>
<div>
<a href="https://github.com/telegr-am/serverless_sample">Sample Source Code</a>
</div>
</div>
</div>
<!-- /container -->
<!--scripts-->
<script type="text/javascript" src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
<script type="text/javascript" src="https://code.jquery.com/ui/1.12.1/jquery-ui.min.js"></script>
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
</body>
</html>