Search code examples
javascriptjquerysharethis

Sharethis doesn't load with AJAX


I am using jquery infinity scroll and jquery masonry plugin on one my projects and also I an using a Sharethis buttons on the pages.

problem is that the Sharethis button dosen't load on the 2nd page, which is loaded using ajax. I am using normal Sharethis code

<script type="text/javascript" src="http://w.sharethis.com/button/buttons.js"></script>
<script type="text/javascript">stLight.options({publisher: "ur-de6b7a4a-e967-4778-5476-54ab547cb1bb", doNotHash: false, doNotCopy: false, hashAddressBar: false});</script>


<span class='st_facebook_hcount' st_url="http://<?php echo $settings['siteurl'];?>/listing-<?php echo $row['id'];?>-<?php echo $PageLink;?>.html" st_title="<?php echo $LongTitle;?>" displayText='Facebook'></span>
<span class='st_twitter_hcount' st_url="http://<?php echo $settings['siteurl'];?>/listing-<?php echo $row['id'];?>-<?php echo $PageLink;?>.html" st_title="<?php echo $LongTitle;?>" displayText='Tweet'></span>
<span class='st_pinterest_hcount' st_url="http://<?php echo $settings['siteurl'];?>/listing-<?php echo $row['id'];?>-<?php echo $PageLink;?>.html" st_title="<?php echo $LongTitle;?>" displayText='Pinterest'></span>

Can anyone tell me a fix for this? did search everywhere but couldn't find an answer.


Solution

  • I just found out that you can use stButtons.locateElements(); fix this this problem. thank everyone for your time.