AddThis WordPress plugin not working with AJAX theme-Collection of common programming errors
I’m using the AddThis WordPress plugin to include share buttons underneath each post in an AJAX theme, and am having trouble getting the code right. Here is the website in question: http://www.jaesonma.net/
I inserted the following code in the custom button field on the settings page:
Then in the post loop in the main page PHP file I have this:
var tbx = document.getElementById("toolbox"),
svcs = {email: 'Email', print: 'Print', facebook: 'Facebook', expanded: 'More'};
for (var s in svcs) {
tbx.innerHTML += ''+svcs[s]+'';
});
function ReinitializeAddThis() {
if (window.addthis) {
window.addthis.toolbox("#toolbox");
}
}
The buttons will only load sporadically, and disappear after a refresh. I’m also getting the error Uncaught ReferenceError: ReinitializeAddThis is not defined which is confusing… I’d really appreciate any insight and I apologize if anything is unclear. Thanks!