user440850
user440850

Reputation: 101

how to alter facebook like button on single page web site with ajax content

I have this problem: The web site is single page so the html is loaded and parsed only once. Now I have dynamic content say some products where I want to add like button. I don't have the problem of show the like button this works well. however i want the the like content will be based on the product that was dynamically loaded. As far as i found and understand I need to include a meta tags which I did but because i have single page I need to alter the content. any suggestions? all i found was about show the like button dynamically which is not the case here.

Upvotes: 1

Views: 413

Answers (2)

Zorox
Zorox

Reputation: 2035

try to reload the Facebook like button (targeting product unique url) after the products loads, then Just trigger the parse function after product load complete .

If you’re using jQuery, there’s a real easy and slick solution to this problem:

$(document).ajaxComplete(function(){
try{
    FB.XFBML.parse(); 
}catch(ex){}});

Upvotes: 2

DMCS
DMCS

Reputation: 31870

Like many blog sites have done in the past, create "static" urls (no querystring parameters) that can access each piece of dynamic page. Such as http://example.com/products/acme_widget_13

Upvotes: 0

Related Questions