Go Back   CodingForums.com > :: Client side development > General web building

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 11-02-2012, 02:56 PM   PM User | #1
MrTIMarshall
Regular Coder

 
Join Date: Nov 2010
Posts: 347
Thanks: 44
Thanked 1 Time in 1 Post
MrTIMarshall is an unknown quantity at this point
Unhappy How to Add the Facebook 'Like' Button for Images on my Website Image Gallery?

Hello,

I have tried so many methods to try and implement the Facebook 'Like' button you see when you on a Fan Page's images on my websites image gallery to also show in the style you see whilst on Facebook and you hover over to see the buttons to 'Like', 'Comment' and 'Shared' amount.

I have tried using the direct image URL, the pages URL and whatnot with the normal 'Like' button you can find on the developers.facebook.com side of Facebook, however, whenever you click on the button, it does not update the 'likes' on the Fan Page and it also doesn't load with the current 'likes'.

I would be very grateful for some help or any advice and thank you in advanced!

Best Regards,
Tim

Last edited by MrTIMarshall; 11-03-2012 at 02:07 PM..
MrTIMarshall is offline   Reply With Quote
Old 11-23-2012, 04:51 AM   PM User | #2
kevin619
New Coder

 
Join Date: Apr 2011
Location: California
Posts: 36
Thanks: 0
Thanked 1 Time in 1 Post
kevin619 is an unknown quantity at this point
Go to Facebook help and find out a solution.
kevin619 is offline   Reply With Quote
Old 11-23-2012, 01:15 PM   PM User | #3
MrTIMarshall
Regular Coder

 
Join Date: Nov 2010
Posts: 347
Thanks: 44
Thanked 1 Time in 1 Post
MrTIMarshall is an unknown quantity at this point
I don't mean to appear to be rude, however do you not thing I have done so and if it was that easy, there wouldn't be almost 5,000 views and no advice so far.
MrTIMarshall is offline   Reply With Quote
Old 11-23-2012, 10:19 PM   PM User | #4
jimutt
New Coder

 
Join Date: Sep 2011
Posts: 47
Thanks: 1
Thanked 15 Times in 14 Posts
jimutt is an unknown quantity at this point
This solution has been working for others:
Code:
$('#likebutton').click(function(){
    $.ajax({
       type: 'POST',
       url: 'https://graph.facebook.com/OBJECT_ID/likes?method=POST&format=json&access_token=TOKEN,
       success: function(res) {
          // do something like style button
        }
    });
});
The reason why it doesn't work for you when you copy the URL it's because the actual "like" is sent by an AJAX request and it's not sent by just sending the user to a specific URL.

I got the code example from this StackOverflow question: http://stackoverflow.com/questions/5...facebook-photo
jimutt is offline   Reply With Quote
The Following 2 Users Say Thank You to jimutt For This Useful Post:
MrTIMarshall (11-24-2012), systems99 (11-27-2012)
Old 11-27-2012, 07:09 AM   PM User | #5
johnnyrand
New to the CF scene

 
Join Date: Nov 2012
Location: USA, Cincinnati
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
johnnyrand is an unknown quantity at this point
Jimutt! The code you have provided here really works for me. I'm also having some problems with the facebook like button as well before. Thanks!
johnnyrand is offline   Reply With Quote
Old 11-28-2012, 02:06 PM   PM User | #6
rameezzahid
New Coder

 
Join Date: Nov 2012
Location: new york
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
rameezzahid is an unknown quantity at this point
You can use this code for face book like button.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>

<body>
<a target="_blank" href="http://www.facebook.com/dialog/feed?app_id=467220903300036&
link= your url
&picture= picture if you need
&name=title of your post
&description=drugstore.com offers Percentage off at Department Store. Save Up to 60% on Cuisinart Kitchen Cookware and Tools at Drugstore.com
&redirect_uri=http://www.test.com/"><img src="http://www.test.com/fbpage/fb_share_button.png"></a>
</body>
</html>

Last edited by Spookster; 11-28-2012 at 03:29 PM.. Reason: just miss the closing tag
rameezzahid is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 06:06 AM.


Advertisement
Log in to turn off these ads.