Addthis not loading on ajax content
addthis, ajax, javascript, jquery
Solution
@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:
<!-- Go to www.addthis.com/dashboard to customize your tools -->
<div class="addthis_sharing_toolbox"></div>
But the formal way as the addthis api doc states to add the buttons to you site is like:
<div class="addthis_toolbox" data-url="domain.com" data-title="title">
<a class="addthis_button_facebook" style="cursor:pointer"></a>
<a class="addthis_button_twitter" style="cursor:pointer"></a>
<a class="addthis_button_email" style="cursor:pointer"></a>
</div>
So, if you add the following lines inside your div box of class 'addthis_sharing_toolbox', it will finally work.
<a class="addthis_button_facebook" style="cursor:pointer"></a>
<a class="addthis_button_twitter" style="cursor:pointer"></a>
<a class="addthis_button_email" style="cursor:pointer"></a>
Problem
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.