开发者

Error While poping up facebook application request dialog in rail application

开发者 https://www.devze.com 2023-03-26 08:53 出处:网络
hi I am using following code to pop up Facebook application request dialog in my rails application. 开发者_运维百科$(\'#app_request\').live(\"click\", function () {

hi I am using following code to pop up Facebook application request dialog in my rails application.

开发者_运维百科
$('#app_request').live("click", function () {
  FB.ui({
        method: 'apprequests',
        message: 'You should learn more about this awesome game.',
        data: 'tracking information for the user'
        });
    });

but I am getting the error as FB is not defined what should I do to correct it. I am new to rail development & FB applications. please guide me. Thank You.


You need to load and initialise the Facebook JavaScript SDK - for example:

<div id="fb-root"></div>
<script>
  window.fbAsyncInit = function() {
    FB.init({appId: 'your app id', status: true, cookie: true, xfbml: true});
  };
  (function() {
    var e = document.createElement('script'); e.async = true;
    e.src = document.location.protocol +
      '//connect.facebook.net/en_US/all.js';
    document.getElementById('fb-root').appendChild(e);
  }());
</script>
0

精彩评论

暂无评论...
验证码 换一张
取 消