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 8408669
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T23:41:48+00:00 2026-06-09T23:41:48+00:00

I am looking on the Facebook Developers Documentation to locate some sample code that

  • 0

I am looking on the Facebook Developers Documentation to locate some sample code that would allow me to capture a click event on the “Like” button. It states:

If you are using the XFBML version of the button, you can subscribe to
the ‘edge.create’ event through FB.Event.subscribe.

I am not using XFBML however, this is my code:

<div class="social_net_button facebook_button">
      <div id="fb-root"></div>
      <script>(function(d, s, id) {
              var js, fjs = d.getElementsByTagName(s)[0];
              if (d.getElementById(id)) {return;}
              js = d.createElement(s); js.id = id;
              js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
              fjs.parentNode.insertBefore(js, fjs);

              FB.Event.subscribe('edge.create',
                     function(response) {
                          alert('You liked the URL: ' + response);
                     }
              );

            }(document, 'script', 'facebook-jssdk'));</script>
      <div class="fb-like" data-href="http://www.facebook.com/pages/Ayrshire-Minis/160330240663397" data-send="false" data-layout="button_count" data-width="70" data-show-faces="false" data-action="recommend"></div>
    </div>

Can a click of the ‘Like’ button be captured by jQuery?

  • 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-09T23:41:50+00:00Added an answer on June 9, 2026 at 11:41 pm

    The solution, it would appear, is sending the request asynchronously. This code below works when placed after my fb-like div class:

         <script>
               window.fbAsyncInit = function() {
                       FB.init({
                                               status: true, // check login status
                                               cookie: true, // enable cookies to allow the server to access the session
                                               xfbml: true  // parse XFBML
                                       });
               };
         </script>
         <script type="text/javascript">
               window.fbAsyncInit = function() {
                 FB.Event.subscribe('edge.create',
                         function(response) {
                               _gaq.push(['_trackSocial', 'facebook', 'like', document.location.href]);
                         }
                 );
               };
         </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm looking the documentation about publishing the message to wall from Facebook app http://developers.facebook.com/docs/reference/dialogs/feed/
I'm looking for some Rails/Facebook functionality that has already been built - as a
I'm looking for a similar option that exist in Facebook (http://developers.facebook.com/docs/reference/plugins/send/) But for google.
I'm looking for a workaround that would allow me to remove the background from
Today I was looking at some code atually from Nikhil Kothari's Facebook.NET API. I
I was reading the facebook API references. http://developers.facebook.com/docs/reference/javascript/FB.Event.subscribe/ My client wants some sort of
I would like to have a facebook looking image (just like the one on
I was looking at some facebook XHR request. I seen that there is a
I'm looking for the right .htaccess rule to make a Facebook.com/user URL like What
I noticed that yesterday all the Fixed-width canvas apps started looking strange: the Facebook

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.