Link registration
This commit is contained in:
parent
e92a343590
commit
41f5e34aa6
2 changed files with 56 additions and 31 deletions
19
web/js/register.js
Normal file
19
web/js/register.js
Normal file
|
@ -0,0 +1,19 @@
|
|||
$("#registration-form").on("submit", function(e) {
|
||||
e.preventDefault();
|
||||
register($("#name").val(), $("#username").val(), $("#password").val(), $("#password_confirm").val(), $("#email").val());
|
||||
});
|
||||
|
||||
function register(name, username, password, password_confirm, email) {
|
||||
$.post("/api/user/register", {
|
||||
name: name,
|
||||
username: username,
|
||||
password: password,
|
||||
password_confirm: password_confirm,
|
||||
email: email
|
||||
}, function(data) {
|
||||
$("#status").text(data.message);
|
||||
if (data.success == 1) {
|
||||
// wait then redirect or whatever
|
||||
}
|
||||
});
|
||||
}
|
|
@ -2,6 +2,7 @@
|
|||
<html>
|
||||
<head>
|
||||
<title>Register</title>
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
|
||||
<script src="js/semantic.min.js"></script>
|
||||
<link type="text/css" rel="stylesheet" href="css/semantic.min.css">
|
||||
<script src='https://www.google.com/recaptcha/api.js'></script>
|
||||
|
@ -20,42 +21,47 @@
|
|||
<h1 style="color: #69D2E7; font-size: 75px;">Register Yourself</h1>
|
||||
<hr style="margin-left: 10em; margin-right: 10em;">
|
||||
<br>
|
||||
<div class="ui input">
|
||||
<input type="text" placeholder="Name" id="name" style="width:50em;">
|
||||
</div>
|
||||
<br><br>
|
||||
<select name="gender" class="ui dropdown" id="select" style="width: 50em;">
|
||||
<option value="1">US Middle/High School Student</option>
|
||||
<option value="2">US Middle/High School Teacher</option>
|
||||
<option value="3">Non-US/Non-Student/Observer</option>
|
||||
</select>
|
||||
<br><br>
|
||||
<div class="ui input">
|
||||
<input type="text" placeholder="Username" style="width:50em;">
|
||||
</div>
|
||||
<br><br>
|
||||
<div class="ui input">
|
||||
<input type="email" placeholder="Email" style="width:50em;">
|
||||
</div>
|
||||
<br><br>
|
||||
<div class="ui input">
|
||||
<input type="password" placeholder="Password" style="width:50em;">
|
||||
</div>
|
||||
<br><br>
|
||||
<div class="ui input">
|
||||
<input type="password" placeholder="Confirm Password" style="width:50em;">
|
||||
</div>
|
||||
<br><br>
|
||||
<div class="g-recaptcha" data-sitekey="6Lc4xhMTAAAAAIaiF3yEWGbHRaGgMg4FHor61p1G"></div>
|
||||
<br><br>
|
||||
<button class="ui primary button" style="width:25em">
|
||||
Submit
|
||||
</button>
|
||||
<form id="registration-form" action="return false;">
|
||||
<div class="ui input">
|
||||
<input id="name" type="text" placeholder="Name" id="name" style="width:50em;">
|
||||
</div>
|
||||
<br><br>
|
||||
<select name="gender" class="ui dropdown" id="select" style="width: 50em;">
|
||||
<option value="1">US Middle/High School Student</option>
|
||||
<option value="2">US Middle/High School Teacher</option>
|
||||
<option value="3">Non-US/Non-Student/Observer</option>
|
||||
</select>
|
||||
<br><br>
|
||||
<div class="ui input">
|
||||
<input id="username" type="text" placeholder="Username" style="width:50em;">
|
||||
</div>
|
||||
<br><br>
|
||||
<div class="ui input">
|
||||
<input id="email" type="email" placeholder="Email" style="width:50em;">
|
||||
</div>
|
||||
<br><br>
|
||||
<div class="ui input">
|
||||
<input id="password" type="password" placeholder="Password" style="width:50em;">
|
||||
</div>
|
||||
<br><br>
|
||||
<div class="ui input">
|
||||
<input id="password_confirm" type="password" placeholder="Confirm Password" style="width:50em;">
|
||||
</div>
|
||||
<br><br>
|
||||
<div class="g-recaptcha" data-sitekey="6Lc4xhMTAAAAAIaiF3yEWGbHRaGgMg4FHor61p1G"></div>
|
||||
<br><br>
|
||||
<button class="ui primary button" style="width:25em">
|
||||
Submit
|
||||
</button>
|
||||
</form>
|
||||
</center>
|
||||
<div id="status">
|
||||
</div>
|
||||
</body>
|
||||
<script>
|
||||
$('#select')
|
||||
.dropdown()
|
||||
;
|
||||
</script>
|
||||
<script src="js/register.js"></script>
|
||||
<html>
|
||||
|
|
Loading…
Reference in a new issue