jquery中$.get()方法输出到页面上的问题
<!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN""http://www.w3.org/TR/xhtml1/...
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>jquery</title>
<script type="text/javascript" src="./scripts/jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#send").click(function() {
$.get("get1.php", {
username : '11',
content : 'aa'
}, function(data, textStatus) {
$("#resText").html(data);
$("#resText").html(txtHtml);
});
})
});
</script>
</head>
<body>
<form id="form1" action="#">
<p>评论:</p>
<p>姓名:<input type="text" name="username" id="username" /></p>
<p>内容:<textarea name="content" id="content" rows="2" cols="20"></textarea></p>
<p><input type="button" id="send" value="提交" /></p>
</form>
<div class="comment">已有评论:</div>
<div id="resText"></div>
</body>
</html>
这样子输出不了,有错误提示 展开
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>jquery</title>
<script type="text/javascript" src="./scripts/jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#send").click(function() {
$.get("get1.php", {
username : '11',
content : 'aa'
}, function(data, textStatus) {
$("#resText").html(data);
$("#resText").html(txtHtml);
});
})
});
</script>
</head>
<body>
<form id="form1" action="#">
<p>评论:</p>
<p>姓名:<input type="text" name="username" id="username" /></p>
<p>内容:<textarea name="content" id="content" rows="2" cols="20"></textarea></p>
<p><input type="button" id="send" value="提交" /></p>
</form>
<div class="comment">已有评论:</div>
<div id="resText"></div>
</body>
</html>
这样子输出不了,有错误提示 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询