I am trying to load addthis button on dynamically loaded content but even though the script is loaded addthis toolbar doesnt appear.
jQuery(".somediv").html(response); // dynamically loaded content
jQuery.getScript("//s7.addthis.com/js/300/addthis_widget.js#pubid=ra-53a011f32e6cd338")
.done(function () {
addthis.init();
addthis.toolbox('.addthis_sharing_toolbox');
})
And below is the html content
<div class="addthis_sharing_toolbox"></div>
Please help.
Step-1: Put the following code into the main template from where you will call the ajax and also display the output:
Step-2: the dynamic (ajax) content should have the following addthis lines with other content:
Step-3: Finally, after successful ajax load run the following line of code with the callback function;
For example:
@amit I was facing the same problem as you. After some research, I rooted the source of this problem.
If you added your addthis button through the dashboard, there is some shortcut html/js codes to add them in your site very quickly:
But the formal way as the addthis api doc states to add the buttons to you site is like:
So, if you add the following lines inside your div box of class 'addthis_sharing_toolbox', it will finally work.