Archive for July 2014

How to load AddThis dynamically with ajax?

On page load there is no issues with AddThis widget. But when the 'Share' button is binding via ajax, then the AddThis functionality will not work. To fix this solution, use the following script.
<script type="text/javascript">
    function generateAddThisButton(ID,URL,Title,Description) {
        var addthis_ui_config =
        {
            services_compact: 'facebook, myspace, igoogle, netvibes, windows, dashboard, more'
        }
        var host = window.location.host;
        var propertyURL = host + URL;
        var propertyTitle = Title;
        var propertyDescription = Description.replace('<p>','').replace('</p>','');
        var addthis_share_config =
        {
            url: propertyURL,
            title: propertyTitle,
            description: propertyDescription
            //swfurl: "http://www.youtube.com/v/1F7DKyFt5pY&hl=en&fs=1",
            //screenshot: "http://i2.ytimg.com/vi/1F7DKyFt5pY/default.jpg"
        }
        addthis.button("#" + ID, addthis_ui_config, addthis_share_config);
    }
</script>
Thursday, 31 July 2014
Posted by Jebastin

Link To This Post/Page

Spread The Word

Add this button to your blog:
JJ Technology Solutions

Blog Archive

Trackers

eXTReMe Tracker
facebook

- Copyright © JJ Technology Solutions - Powered by Source Code Solutions -