只有$。阿贾克斯()获得身 [英] $.ajax() get body only
本文介绍了只有$。阿贾克斯()获得身的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有这样的脚本
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Testing Ajax</title>
<script type="text/javascript" src="jquery.js"></script>
</head>
<body>
<a class="test" href="getthis.php">click here</a>
<div class="get"></div>
<script type="text/javascript">
$('.test').click(function(event){
event.preventDefault();
var a = $('body');
$.ajax({
url: "/getthis.php",
dataType: 'text',
success: function(data){
$('.get').append(data.find);
}
});
});
</script>
</body>
</html>
这个剧本我试图让内容getthis.php
with this script i try to get content getthis.php
getthis.php只包含这个
getthis.php contains only this
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//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></title>
</head>
<body>
Olalalalala bebe
</body>
</html>
当我这样做我得到结果getthis.php的全功能HTML
when i do this i get result the full html of the getthis.php
我怎样才能到只能获得主体内容? 这是唯一的意思。 Olalalalala贝贝
how i can to only get body content? which is mean only. "Olalalalala bebe"
可有人给我解释吗?
谢谢...
推荐答案
使用 http://api.jquery.com/load/ < /一>您可以加载特定页面片段
use http://api.jquery.com/load/ you can load specific page fragments
这篇关于只有$。阿贾克斯()获得身的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文