Skip to content

Commit c16a845

Browse files
committed
update post
1 parent 8f7ad63 commit c16a845

File tree

2 files changed

+116
-70
lines changed

2 files changed

+116
-70
lines changed

jquery/.idea/workspace.xml

Lines changed: 72 additions & 70 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

jquery/ch6/jsp/demo4-post/post3.html

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
2+
"http://www.w3.org/TR/html4/loose.dtd">
3+
<html>
4+
<head>
5+
<title>post3</title>
6+
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
7+
<style>
8+
* { margin:0; padding:0;}
9+
body { font-size:12px;}
10+
.comment { margin-top:10px; padding:10px; border:1px solid #ccc;background:#DDD;}
11+
.comment h6 { font-weight:700; font-size:14px;}
12+
.para { margin-top:5px; text-indent:2em;background:#DDD;}
13+
</style>
14+
<!-- 引入jQuery -->
15+
<script src="../scripts/jquery.js" type="text/javascript"></script>
16+
<script type="text/javascript">
17+
$(document).ready(function () {
18+
$("#send").click(function () {
19+
$.post("post3.jsp",{
20+
usernmae: $("#username").val(),
21+
content: $("#content").val()
22+
},function (data,textStatus) {
23+
var username = data.username;
24+
var content = data.content;
25+
var txtHtml = "<div class='comment'><h6>"+username+":</h6><p class='para'>"+content+"</p></div>";
26+
$("#resText").html(txtHtml); // 把返回的数据添加到页面上
27+
},"json")
28+
})
29+
})
30+
</script>
31+
</head>
32+
<body>
33+
<form id="form1">
34+
<p>评论:</p>
35+
<p>姓名: <input type="text" name="username" id="username" /></p>
36+
<p>内容: <textarea id="content" ></textarea></p>
37+
<p><input type="button" id="send" value="提交"/></p>
38+
</form>
39+
<div class='comment'>已有评论:</div>
40+
<div id="resText" >
41+
</div>
42+
43+
</body>
44+
</html>

0 commit comments

Comments
 (0)