Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/424.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 在回调中使用comment.create侦听器for fb:comments-fql.query comment_Javascript_Facebook_Facebook Javascript Sdk_Dom Events - Fatal编程技术网

Javascript 在回调中使用comment.create侦听器for fb:comments-fql.query comment

Javascript 在回调中使用comment.create侦听器for fb:comments-fql.query comment,javascript,facebook,facebook-javascript-sdk,dom-events,Javascript,Facebook,Facebook Javascript Sdk,Dom Events,我插入了以下有效的插件: <fb:comments href="http://www.example.com/" width="580" num_posts="10"></fb:comments> <div id="fb-root"></div> <script type="text/javascript"> window.fbAsyncInit = function() { v

我插入了以下有效的插件:

<fb:comments href="http://www.example.com/" width="580" num_posts="10"></fb:comments>
        <div id="fb-root"></div>

    <script type="text/javascript">
      window.fbAsyncInit = function() {

        var post_id = 64564346456756;
        var user_id = 12434566778788;

        // init the FB JS SDK
        FB.init({
          appId      : '75645367543465745', // App ID from the App Dashboard
          status     : true, // check the login status upon init?
          cookie     : true, // set sessions cookies to allow your server to access the session?
          xfbml      : true  // parse XFBML tags on this page?
        });

        //post comment
        FB.Event.subscribe('comment.create', function(comment_response){ 
            //console.log( comment_response );

            //try to post on fanpage ... login
            FB.login(function(login_response) {
                 //console.log(response);

                 // user is logged in and granted permissions.
                  if (login_response.authResponse) {

                      //get comment
                      //comment_response.commentID comment_response.href
                      //console.log( comment_response.commentID );

                      FB.api({
                            method: 'fql.query',
                            query: "SELECT text FROM comment WHERE post_fbid = '"+comment_response.commentID+"' AND object_id IN (SELECT comments_fbid FROM link_stat WHERE url='http://www.example.com/')",
                            access_token: login_response.accessToken
                          },
                          function( response ) {

                              //console.log( resp[0].text );
                              console.log(response);


                          });

                  } 
                  else { // User cancelled login or did not fully authorize.

                  }
             }, {scope:'publish_stream, read_stream'});

        });


      };

      // Load the SDK's source Asynchronously
      (function(d, debug){
         var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
         if (d.getElementById(id)) {return;}
         js = d.createElement('script'); js.id = id; js.async = true;
         js.src = "//connect.facebook.net/de_DE/all" + (debug ? "/debug" : "") + ".js";
         ref.parentNode.insertBefore(js, ref);
       }(document, /*debug*/ false));

    </script>

    <fb:comments href="http://www.example.com/" width="580" num_posts="10"></fb:comments>