JSON Javascript Onclick加载程序

I have a little script reading out a JSON feed and writing it down in HTML. Now I want my scirpt to only show 5 elements and load the next 5 elements with an forward button or to show the last 5 with a backward button Is there any possility to do that? Just give me a few pointers, where I could start my research for building a function like that.

My code till now, just to show you guys :

<script type="text/javascript">
$(function()
{
$(document).ready(function()
{
$.getJSON("json_data2.php",function(data)
{
$.each(data.posts, function(i,data)
{
var div_data =
"<div ><a href='"+data.url+"'>"+data.title+"</a></div>";
$(div_data).appendTo("#test");
});
}
);
return false;
});
});
</script>

<div id="test"></div>
查看全部
weixin_33698823
weixin_33698823
2012/12/04 19:26
  • json
  • ajax
  • javascript
  • 点赞
  • 收藏
  • 回答
    私信

1个回复