Can I somehow easy get googlebot to see this ajax content? Using post ajax method:
Calling page:
<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>";
?>
This is just what i want and it works. The navigation is generated in the ajax call. Only problem is that Google cant see it…
Google explains exactly how to do it. FYI, using Ajax or JavaScript in general to generate your content is a really bad idea.