-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
59 lines (59 loc) · 1.37 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
<!DOCTYPE html>
<html>
<head>
<title>welcome to mongodb</title>
<style type="text/css">
.todo{float:left;margin-right:2em;}
</style>
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
</head>
<body>
<h1>welcome to mongodb</h1>
<ul class="todo">
<li>Delete</li>
<li>Count</li>
<li>Edit</li>
</ul>
<form method="post" class="form" action="/newguest">
Name:<input type="text" name="name"/>
Email:<input type="text" name="email"/>
<input type="submit" value="Add Guest"/>
</form>
<h3>Guests:{{count}}</h3>
<table border="1">
<thead>
<tr>
<th>Id</th>
<th>Name</th>
<th>Email</th>
<th></th>
</tr>
</thead>
<tbody>
%for name in mynames:
<tr>
<td>{{name['id']}}</td>
<td>{{name['name']}}</td>
<td>{{name['email']}}</td>
<td><a href="#">Del</a></td>
</tr>
%end
</tbody>
</table>
<script type="text/javascript">
$(document).ready(function(){
$('a').click(function(){
var row=$(this).closest('tr');
var cell = row.find("td:nth-child(1)").text();
alert(cell);
$.ajax({
type:'POST',
url:'/delete/'+cell,
data:{id:cell}
});
$('body').load('/');
})
});
</script>
</body>
</html>