$(".nav_a").live('click',function(e){
var href = $(this).attr('href');
$.ajax({
type:"get",
url: href,
success: function(response){
$("#content").html(response);
}
});
}); 由ajax来发送请求,得到的response其实是一个html文件。内容为:
<body>
<div class='content'>
<ul id="rooms" >
………………………………此处代码省略
</ul> <script>
$(document).ready(function(){
…………………………………此处代码省略
});
</script>
</div>
</body>
可是我想取它的<div class='content'></div> 这个div下面的内容,该怎么取呢?就红色部分(这里吐槽一下,CSDN的编辑器有点弱)我记得好像可以这样写:
content = response.find("#content").html();请大家帮个忙
var href = $(this).attr('href');
$.ajax({
type:"get",
url: href,
success: function(response){
$("#content").html(response);
}
});
}); 由ajax来发送请求,得到的response其实是一个html文件。内容为:
<body>
<div class='content'>
<ul id="rooms" >
………………………………此处代码省略
</ul> <script>
$(document).ready(function(){
…………………………………此处代码省略
});
</script>
</div>
</body>
可是我想取它的<div class='content'></div> 这个div下面的内容,该怎么取呢?就红色部分(这里吐槽一下,CSDN的编辑器有点弱)我记得好像可以这样写:
content = response.find("#content").html();请大家帮个忙
content = $(response).find("#content").html();
alert(dom.find("#content").html());