首页 > 其他 > 详细

load()方法

时间:2017-04-18 14:04:35      阅读:139      评论:0      收藏:0      [点我收藏+]

<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>loading</title>
<script src="../scripts/jquery-1.3.1.js" type="text/javascript"></script>
<style>
.container{
width: 60%;
margin: 0 auto;
border:1px solid #666;
}
.comment{
background-color: #cfcfcf;
}

</style>
</head>
<body>
<div class="container">
<input type="button" id="send" value="Ajax获取">
<div class="comment">已有评论</div>
<div id="resText"></div>
</div>
<script type="text/javascript">
$("#send").click(function() {
$("#resText").load("text.html",function(responseText,textStatus,XMLHttpRequest) {
alert(responseText);
alert(textStatus);
alert(XMLHttpRequest);

});
});n
</script>
</body>
</html>

//要加载的文件text.html,如下代码

<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>loading</title>
</head>
<body>
<div class="comment">
<h6>张三</h6>
<p class="para">学生1</p>
</div>
<div class="comment">
<h6>李四</h6>
<p class="para">学生2</p>
</div>
<div class="comment">
<h6>小明</h6>
<p class="para">学生3</p>
</div>
</body>
</html>

 

load()方法

原文:http://www.cnblogs.com/linjing-blog/p/6727314.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!