Facebook Graph API - 分页 [英] Facebook Graph API - Paging

查看:139
本文介绍了Facebook Graph API - 分页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  FB.api('/ me / home' ,function(response){

});

这将返回一个分页对象,其中包含两个值: previous next



在我的应用程序中,我想要一个按钮加载更多用于分页。所以我需要使用这些值从API中加载下一批数据。



我的问题是我应该如何加载这些数据? 以前的下一个是不支持JavaScript Graph API的全长URL( FB .API( '...'))。我应该如何使用它提供给我的URL?或者有更好的分页方式吗?

解决方案

您应该对服务器端请求上一个和下一个并将结果发送给客户,点击您的分页链接/按钮。



编辑



或只是缩短这些网址。让他们相对而不是绝对的


I am getting a user's posts with the Facebook API like so:

FB.api('/me/home', function (response) {

});

This returns a paging object, with two values: previous and next.

Later in my app, I want to have a button to 'load more' for pagination. So I need to use these values to load the next lot of data from the API.

My question is how I am supposed to load this data? previous and next are full length URLs which do not work with the JavaScript Graph API (FB.api('...')). How exactly am I supposed to use the URL it provides me with? Or is there a better way to do pagination?

解决方案

You should do server-side requests to 'previous' and 'next' and send the results to a client on clicking your pagination links/buttons.

EDIT

Or just shorten these urls. Make them relative instead of absolute

这篇关于Facebook Graph API - 分页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆