我能以某种方式轻松获取googlebot以查看此ajax内容吗?使用post ajax方法:
致电页面:
<html>
<head>
<title>TEST</title>
</head>
<body onload="getTest(1)">
<div id="txtHint"></div>
<script type="text/javascript">
function getTest(page)
{
var parameters = "";
document.getElementById("txtHint").innerHTML="";
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("txtHint").innerHTML=xmlhttp.responseText;
}
}
parameters = parameters + "page="+page;
xmlhttp.open("POST","ajaxtest.php",true);
xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
xmlhttp.send(parameters);
}
</script>
</body>
</html>
ajaxtest.php:
<?php
$page=$_POST["page"];
echo "This is page number $page <br />";
echo "<a href='javascript:getTest(2);'>Link to page 2</a>";
?>
这正是我想要的,它的工作原理。导航在ajax调用中生成。唯一的问题是Google无法看到它......
答案 0 :(得分:0)
Google explains exactly how to do it。仅供参考,通常使用Ajax或JavaScript来生成内容a really bad idea。
答案 1 :(得分:0)
<div id="txtHint"><?php include 'ajaxtest.php'; ?></div>
无法解决您的问题?