-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsample.html
69 lines (59 loc) · 1.69 KB
/
sample.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
<!DOCTYPE html>
<html>
<head>
<title>Hackathon</title>
<!-- Include core bootstrap -->
<script type="text/javascript" src="http://studs.gpsgate.com/Services/Core.ashx?xss2=true&deps=true"></script>
<!-- Google maps API -->
<!-- https://developers.google.com/maps/documentation/javascript/tutorial -->
<!-- <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?sensor=true"></script> -->
<script>
// Include session handling (login/logout) + jQuery
goog.require('GpsGate.Session');
// knockout (http://http://knockoutjs.com/)
// goog.require('ko');
</script>
<script>
// Include hackathon web service
GpsGate.require('GpsGate.Server.Hackathon');
</script>
<script>
function doLogin() {
var appId = 5;
var username = '';
var password = '';
return GpsGate.Session.login(username, password, { appId: appId }).addCallbacks(
function(result) {
console.log('Login OK');
setTimeout(mainProgram, 0); // use timeout "trick" to get out of the deferred callback chain scope
},
function(error) {
console.error("that's a bummer!")
}
);
}
function mainProgram() {
// do something
console.log('app.main');
// Get some users
GpsGate.Server.Hackathon.GetUpdatedUsers().addCallbacks(
function(response) {
var ul = jQuery('#users');
for (var i = 0; i < response.users.length; i++) {
ul.append('<li>' + response.users[i].name + '</li>');
}
},
function(error) { }
);
}
jQuery(document).ready(doLogin);
</script>
</head>
<body>
<div>
Some UI stuff here...
<ul id="users">
</ul>
</div>
</body>
</html>