-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.cfm
95 lines (77 loc) · 2.47 KB
/
index.cfm
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
<cfinvoke
component="cfc.Players"
method="getAllPlayers"
returnvariable="playerList">
</cfinvoke>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Are you playing? Or not?</title>
<meta name="viewport" content="width=device-width, height=device-height, initial-scale=1">
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.css" />
<script src="http://code.jquery.com/jquery-1.6.4.min.js"></script>
<script src="http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.js"></script>
<script language="javascript">
$("#login").live("pageinit", function()
{
console.log("Ready index");
// submit saved avalability data to backend
$("#submit").bind( "click", function(event, ui)
{
event.preventDefault();
console.log("submit clicked");
var username = $.trim( $('#username').val() );
var password = $.trim( $('#password').val() );
$.mobile.showPageLoadingMsg();
$.post("cfc/Players.cfc?method=login&returnformat=json",
{username:username,password:password},
function(res)
{
if(res)
{
if (res == 'true')
{
console.log(res);
$.mobile.hidePageLoadingMsg();
//$.mobile.changePage('home.cfm', {reloadPage:true});
window.location.href = "home.cfm";
}
else
{
$.mobile.hidePageLoadingMsg();
}
}
else
{
//warn user of error
$.mobile.hidePageLoadingMsg();
}
}
);
return false;
});
});
</script>
</head>
<body>
<div data-role="page" id="login" data-title="Login" data-theme="e">
<div data-role="header" data-theme="e">
<h1>Playingornot.com - Login</h1>
</div>
<div data-role="content">
<p>Who are you?</p>
<div data-role="fieldcontain" class="ui-hide-label">
<form method="post">
<label for="username">Username:</label>
<input type="text" name="username" id="username" value="Stefan" placeholder="Username"/>
<label for="password">Password:</label>
<input type="password" name="password" id="password" value="abc" placeholder="Password"/>
<input type="submit" value="Login" id="submit" data-inline="true">
</form>
</div>
</div>
<cfinclude template="includes/footer.cfm">
</div>
</body>
</html>