我的应用获得了批准publish_actions。每个帖子之间的时间间隔
我想在feed文章发表评论。
一切工作正常。
以下是我的工作代码。
function home(token){
jQuery.ajax({
url:'https://graph.facebook.com/me/home?fields=id&limit=2&method=get&access_token='+token,
dataType:'jsonp',
success:function(data){
post_comment(data,token);
}
});
}
function post_comment(list,token){
for(i=0;i<list.data.length;i++){
jQuery.ajax({
url:'https://graph.facebook.com/'+list.data[i].id+'/comments?message=testing&method=POST&access_token=' + token,
dataType:'script',
success:function(){
gonderildi += 1;
if(gonderildi >= list.data.length){
}
}
});
}
}
输出。
https://graph.facebook.com/XXXXXXXXXXXX/comments?message=testing&method=POST&access_token=XXXXXX.
https://graph.facebook.com/XXXXXXXXXXXX/comments?message=testing&method=POST&access_token=XXXXXX.
我只需要设置每个帖子之间的间隔。
例
https://graph.facebook.com/XXXXXXXXXXXX/comments?message=testing&method=POST&access_token=XXXXXX.
Wait 5 sec.
https://graph.facebook.com/XXXXXXXXXXXX/comments?message=testing&method=POST&access_token=XXXXXX.
5秒后它应该发布的另一请求。 帮助。
的setInterval? https://developer.mozilla.org/en-US/docs/Web/API/WindowTimers/setInterval – andrrs
我尝试过,没有多少运气给我。 –