1

I'm trying to add a FB like button for recommendations to an AJAX driven search page. I've already implemented it successfully in a static template, but it seems to be more complicated to implement dynamically changing likes on a single page. is there a way to inject the .fb-like template to the page dynamically and make facebook render it to create the necessary IFRAME? Clearly facebook does it onload, but can it be triggered manually with JS?

The original FB html to be embedded:

  <div class="fb-like" data-href="http://mattat.org.il/ci/index.php/
    search/show_full/nsrecommendation/{{q}}" 
    data-send="true" data-layout="button_count" 
    data-width="450" data-show-faces="true" data-font="arial"></div>

The {{q}} will be dynamically replaced with the current recommendation id

2

1 Answer 1

3

following the FB http://developers.facebook.com/docs/reference/javascript/FB.XFBML.parse/

you need to execute after ajax finishes

FB.XFBML.parse();
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.