Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8217781
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T12:34:10+00:00 2026-06-07T12:34:10+00:00

Can anyone tell me why callbacks are not working for the like-button code given

  • 0

Can anyone tell me why callbacks are not working for the like-button code given below? The code is a standard set up in JavaScript as far as I can see. The first button is initialized, then the API is loaded asynchronously, and callback functions are provided.

<div id="fb-root"></div>
<script>

window.fbAsyncInit=function(){
    FB.init({
        appId:'',//App ID
        status:false,// check login status
        cookie:true,// enable cookies to allow the server to access the session
        xfbml:true// parse XFBML
    });
    // Additional initialization code here

    FB.Event.subscribe('edge.create', function(response) {
        //alert("user_id1:<?php echo $user_id1; ?>, user_id2:<?php echo $user_id2; ?>");
        /*var data={
            action:"ap_buttons_give_points",
            author_id:<?php echo $author_id; ?>,
            post_id:<?php echo $post_id; ?>,
            type:"like"
        }

        jQuery.post("<?php echo $ajax_url; ?>",data,function(resp){

        });*/
    alert('You just liked the page!');
});

    FB.Event.subscribe('edge.remove', function(response) {
        /*var data={
            action:"ap_buttons_take_points",
            author_id:<?php echo $author_id; ?>,
            post_id:<?php echo $post_id; ?>,
            type:"like"
        }

        jQuery.post("<?php echo $ajax_url; ?>",data,function(resp){
            //alert("fb remove:"+resp);
        });*/
    alert('You just unliked the page!');
});
};

// Load the SDK Asynchronously
(function(d){
    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/en_US/all.js";
    ref.parentNode.insertBefore(js, ref);
}(document));
</script>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T12:34:11+00:00Added an answer on June 7, 2026 at 12:34 pm

    Yes, the code seems fine. I kinda had the same problem but only with fb like button, the iframe version.
    I don’t see the fb button in your example, so I don’t know which one you use… So, from my experience, use the standard fb like.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can anyone tell me why this code would not be working? $('body').on('test', function() {
Can anyone tell me why the following code fails to submit the form into
Can anyone tell why my jQuery script is not loading here <?php wp_enqueue_script(jquery); ?>
Can anyone tell me why this code crashes with SIGABRT unrecognised selector sent to
Can anyone tell me why my icon in div id=combinedClasp is not centering on
can anyone tell me why this animation isn't starting? i've tried putting code in
Can anyone tell me why this works in mysql? update routing_policy set priority=''-1 where
I wondered if anyone can tell me simply (I know this is not a
Can anyone tell me how I can display a status message like 12 seconds
Can anyone tell me what exactly does this Java code do? SecureRandom random =

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.