How to publish Actions to Facebook Graph API with parameters in call URL

≡放荡痞女 提交于 2019-12-04 21:58:09
Arturo Zvezda

I've not tested it but i see something different from the code examples in this link

http://developers.facebook.com/docs/opengraph/tutorial/#publish

In your code passString should start with ? as is the very beginning of the query string.

// so this :
passString = '&object=http://mysite.com/appnamespace/object.php?userName=' + userName;
// should be :
passString = '?object=http://mysite.com/appnamespace/object.php?userName=' + userName;

  FB.api('/me/APP_NAMESPACE:ACTION' + passString,'post',
     function(response) {
          if (!response || response.error) {
              alert(response.error.message);
          } 
          else {
              alert('Post was successful! Action ID: ' + response.id);
          } 
      }
  );    
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!