1

I am adding social share option on the page using Add This.

I have added the code to my phtml file and added the js script in the head, which is working fine.

Also, I have an option to filter data on the select category on the same page. In that case, data is coming from the controller using ajax. everything is working perfectly except social share option.

After selecting the category from dropdown the data filters using ajax, but social share option is not coming.

I think script needs to be the load again for the social share buttons.

social share button add this code:

<div class="addthis_inline_share_toolbox" data-url="<?php echo $baseURL_l.'video#'.$url?>" data-title="<?php echo $video->getVideoTitle(); ?>" addthis:media="<?php echo 'https://img.youtube.com/vi/'.$video->getVideoUrl() ?>/0.jpg" ></div>

and script:

<script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=ra-5a4219ef9de357a6"></script>
asked Dec 28, 2017 at 4:22

1 Answer 1

0

Try to add below code after ajax response.

jQuery(document).ajaxStop(function() {
 if (window.addthis) {
 window.addthis = null;
 window._adr = null;
 window._atc = null;
 window._atd = null;
 window._ate = null;
 window._atr = null;
 window._atw = null;
 }
 return jQuery.getScript("http://s7.addthis.com/js/300/addthis_widget.js#pubid=ra-5a4219ef9de357a6");
 });
answered Jan 19, 2018 at 5:06

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.