-
Notifications
You must be signed in to change notification settings - Fork 0
/
checkin.html
126 lines (96 loc) · 3.32 KB
/
checkin.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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Test PhoneGap</title>
<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no, width=device-width">
<link rel="stylesheet" href="css/jquery.mobile-1.2.0.css" />
<link rel="stylesheet" href="css/style.css" />
<script src="js/jquery-1.8.2.min.js"></script>
<script src="js/jquery.mobile-1.2.0.min.js"></script>
<script src="js/cordova-2.1.0.js"></script>
</head>
<body>
<script>
$(document).bind("pagebeforeshow", function (event, data) {
if (!localStorage.getItem("LoggedInUser")) {
event.preventDefault();
$.mobile.changePage("login.html");
}
});
function onSuccess(data, status)
{
dataj = jQuery.parseJSON(data);
user_name = dataj.item.username;
alert (user_name);
if (dataj.item.status == 'success') {
$("#notification").text(user_name);
window.localStorage.setItem('LoggedInUser', user_name);
$.mobile.changePage("main.html");
}
else {
window.localStorage.setItem('LoggedInUser', '');
$("#notification").text("Log in Failed.");
}
}
function onError(data, status)
{
// handle an error
}
$(document).ready(function() {
$("#submit").click(function() {
var formData = $("#RegisterForm").serialize();
$.ajax({
type: "POST",
url: "http://i-hate-flight-delays.herokuapp.com/account/checkin",
cache: false,
data: formData,
success: onSuccess,
error: onError
});
return false;
});
});
</script>
<!-- ################################### BEGIN MAIN PAGE ######################################## -->
<div data-role="page" id="list_page" data-theme="c">
<!-- BEGIN HEADER -->
<!-- BEGIN HEADER -->
<div id="header" data-role="header" data-position="fixed" data-theme="c">
<a href="index.html" data-role="button" rel="external">Home</a>
<h1>I Hate Flight Delays</h1>
<a href="logoff.html" data-role="button">Log Out</a>
</div>
<!-- END HEADER -->
<!-- END HEADER -->
<!-- BEGIN CONTENT -->
<div data-role="content">
<div id="input" data-role="fieldcontain">
<form id="checkinForm">
<label for="flight_number">Flight number (eg CA583)</label>
<input type="text" name="flight_number" id="flight_number" value="" />
<br />
<!--
<p>Or:</p>
<label for="From Airport">From airport</label>
<input type="text" name="fromAirport" id="fromAirport" value="" />
<br />
<label for="To Airport">To airport</label>
<input type="text" name="toAirport" id="toAirport" value="" />
/-->
<h3 id="notification"></h3>
<button data-theme="b" id="submit" type="submit">Submit</button>
</form>
</div>
<div id="flight_info">
</div>
</div>
<!-- END CONTENT -->
<!-- BEGIN FOOTER -->
<div data-role="footer" data-position="fixed" style="height: 50px; vertical-align:middle">
<p align="center"><a href="index.html" data-role="button" rel="external">Home</a></p>
<!-- END FOOTER -->
</div>
<!-- ##################################### END MAIN PAGE ######################################### -->
</body>
</html>