-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlist.html
More file actions
63 lines (57 loc) · 2.38 KB
/
list.html
File metadata and controls
63 lines (57 loc) · 2.38 KB
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
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>Blog List</title>
<script type="text/javascript"src="jquery.js"></script>
<script type="text/javascript"charset="utf-8">
$(document).ready(function() {
$.getJSON('listall', function(data) {
var lists = $('#lists');
if (data && data.length > 0) {
for (var i = 0; i <data.length; ++i) {
var b = data[i];
var div = $('<divclass="blog"></div>');
if (b.title) {
var h = $('<h3/>');
h.html(b.title);
div.append(h);
}
if (b.content) {
var c = $('<div/>');
c.html(b.content);
div.append(c);
}
div.appendTo(lists);
}
}
});
$('#submitBtn').click(function() {
var title = $('#title').val();
var content = $('#content').val();
$.post('new',
{ 'title' : title, 'content' : content },
function(data) {
},
'json'
);
});
});
</script>
</head>
<body>
<div>
<div id="titleDiv">
<input type="text"id="title"name="title"value="">
</div>
<div id="contentDiv">
<textarea line="3"id="content" name="content"></textarea>
</div>
<divid="name">
<input type="button"id="submitBtn" value="Create"/>
</div>
</div>
<div id="lists">
</div>
</body>
</html>