-3

i have a javascript gallery wich is a jcarousel so user can press next and prev button and view multiple product, in the middle of prev and bext button you find a FB like button, what i need is if user clicks like on one product if he then clicks next or prev the FB like button will be available for clicking(because that's another product), so this would be surly easier in a per page system, so right now each click on the FB like button has a unique url(i did this using the fragment part with jquery address plugin), i also changing dinamically the ref attribute of the xfbml like button thinking that would reset the button(so each product would have a unique button),

<fb:like send="false" width="450" ref="" show_faces="false" data-layout="button_count"  id="fb_like" ></fb:like> 

changing the ref dynamically gives the FB like button uniqueness because of this:

    When a user clicks a link back to your website, we will pass back both
 the ref value as a fb_ref parameter and the fb_source parameter 
in the referrer URL

but this doesnt reset the button to a "clickable" state if the like button has not been pressed.

tetris
  • 4,302
  • 6
  • 28
  • 41

1 Answers1

0

The Like button will only retain the initial value. You have to build out the fb:like statement if you want to make it dynamic. Wrap the entire thing in jQuery.

Another user has sample code here that I found useful Update FB:Like URL Dynamically using JavaScript that works for AJAX calls.

From that post:

$('#like').html('<fb:like href="' + url + '" layout="button_count" show_faces="false" width="65" action="like" font="segoe ui" colorscheme="light" />');
if (typeof FB !== 'undefined') {
    FB.XFBML.parse(document.getElementById('like'));
}

HTML:

<span id="like"></span>

All credit to Mohammed Arif

Community
  • 1
  • 1
Jered Cuenco
  • 16
  • 1
  • 2