无法使用facebook SDK发布Facebook网址

时间:2012-07-11 23:33:17

标签: facebook facebook-graph-api jsonp facebook-javascript-sdk

我有一个用于转发现有帖子的web应用程序,如下所示 1)使用https://graph.facebook.com/UserID_postID?access_token=AAA获取帖子详细信息(工作正常) 2)从旧帖子中填写新帖子的数据并尝试重新发送但是有一些奇怪的行为 如果我使用 oldpost.link = newpost.link它没有出现在墙上,但如果我使用 oldpost.link =“\”“newpost.link +”\“”工作,帖子出现在Facebook墙上,但链接显示为无效。无效/

function getPost(userID,postID,token){     jQuery.getJSON(“https://graph.facebook.com/”+ userID +“_”+ postID +“?access_token =”+ token,function(post){      这是代码任何想法请

    var newPost = {};
    newPost.message = "hi";
      if (post.link != "" && post.link != null && post.link != "undefined") {
            newPost.link = "\"" + post.link + "\"";
        }
        if (post.name != "" && post.name != null && post.name != "undefined") {
            newPost.name = "\"" + post.name + "\"";
        }
        if (post.picture != "" && post.picture != null && post.picture != "undefined") {
            newPost.picture = "\"" + post.picture + "\"";
        }
        if (post.description != "" && post.description != null && post.description != "undefined") {
            newPost.description = "\"" + post.description + "\"";
        }



        doPost(newPost);
    });
}

function doPost(newPost) {

    FB.api('/me/feed', 'post',
              newPost, function (response) {
                    if (!response || response.error) {
                        alert(' Denied Access');
                    } else {
                        alert('Success');
                    }
                });
}

0 个答案:

没有答案