-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
82 lines (76 loc) · 3.2 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<link rel="stylesheet" href="./bootstrap/css/bootstrap.min.css" />
<title>API Interface</title>
</head>
<body>
<div class="container">
<div class="row">
<div class="col-12-lg">
<h1>API Interface</h1>
<div class="alert alert-warning" id="api-messages" role="alert"></div>
<ul class="nav nav-tabs" role="tablist">
<li class="active">
<a href="#create" role="tab" data- toggle="tab">Create User</a>
</li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="create">
<div class="form-group">
<label for="createEmail">Email</label>
<input type="text" class="form-control" id="createEmail" placeholder="Enter email" />
</div>
<div class="form-group">
<label for="createUsername">Username</label>
<input type="text" class="form-control" id="createUsername" placeholder="Enter username" />
</div>
<div class="form-group">
<label for="createFirst">First Name</label>
<input type="text" class="form-control" id="createFirst" placeholder="First Name" />
</div>
<div class="form-group">
<label for="createLast">Last Name</label>
<input type="text" class="form-control" id="createLast" placeholder="Last Name" />
</div>
<div class="form-group">
<label for="createLast">Image</label>
<input type="file" class="form-control" name="image" id="createImage" placeholder="Image" />
</div>
<button type="submit" onclick="userCreate();" class="btn btn-success">
Create
</button>
</div>
</div>
</div>
</div>
</div>
<script>
function userCreate() {
action = "http://localhost:3000/api/users";
postData = {};
postData.email = $("#createEmail").val();
postData.user = $("#createUsername").val();
postData.first = $("#createFirst").val();
postData.last = $("#createLast").val();
postData.image = $("#createImage").val();
$.post(
action,
postData,
function (data) {
if (data.error) {
$(".alert").html(data.error);
$(".alert").alert();
}
},
"jsonp"
);
}
//$(document).ready(function () {
// $(".alert").alert("close");
//});
</script>
</body>
</html>