ajax问题,怎么实现上一页,下一页?
初用ajax 不知用什么途径记录获取上一次的查询页数。。。
求思路。。
<div onclick="showHint(-1)">上一页</div><div onclick="showHint(+1);">下一页</div>
<script>
function showHint(str)
{
var s=0+str;
var xmlhttp;
//if (str.length==0)
// {
// document.getElementById("txtHint").innerHTML="";
// return;
// }
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;
}
}
alert(s);
xmlhttp.open("GET","ajax.php?q="+s,true);
xmlhttp.send();
}
</script>