Javascript reinitialize Facebook and Share This on AJAX page load

When loading a page with AJAX, it's necessary to reinitialize facebook connect and shareThis. Here's how:

For facebook, just add this line of code to the event handler that loads the ajax:

FB.XFBML.parse();

For Share This, first load the buttons.js file, then run the stLight.options() function:

$.ajax({
    url: 'http://w.sharethis.com/button/buttons.js',
    dataType: 'script',
    success: function(){
    stLight.options({
    publisher: 'ur-bdb9dcc1-7d59-5525-c85f-dfca40fd695',
    onhover: false
    });
    },
    cache: true
});

Internal References

Article Type

General