Hello!
I need this question answered:
Trying to load a page via ajax. There is no page reloading, page navigation happens with hashtags (#) .. so the first time (after a page reload) the addThis-plugin is rendered well, the second time it won't even show up or shows up crippled. What can I do about that? Please help!! My code:
<div id="fillme"></div>
<script>
var html = '<div class="addthis_toolbox addthis_default_style addthis_32x32_style"><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a><a class="addthis_counter addthis_bubble_style"></a></div>';
var cache = jQuery.ajaxSettings.cache;
jQuery.ajaxSettings.cache = true;
jQuery.getScript('http://s7.addthis.com/js/300/addthis_widget.js#pubid=PUB_ID?domready=1');
// Restore jQuery caching setting
jQuery.ajaxSettings.cache = cache;
$('#fillme').html(html);
</script>
I have struggeld hours now.. Someone can help? Thanks!
Found the answer myself:
function ReinitializeAddThis(){
if (window.addthis){
window.addthis.ost = 0;
window.addthis.ready();
}
}
$.ajax({
url: "http://s7.addthis.com/js/300/addthis_widget.js#PUB_ID",
dataType: 'script',
success: function(){
ReinitializeAddThis();
}
});
@AddThis-devs: PLEASE think of ajax devs! I was really searching for this solution for HOURS....
This question is closed to new answers.