Addthis not working with Ajax

后端 未结 9 1902
广开言路
广开言路 2021-02-07 14:38

I am loading all articles with Ajax but Addthis functionality is not correct

 $thisChild.load( permLink + \' #thePostStuff\', function() {

And

9条回答
  •  夕颜
    夕颜 (楼主)
    2021-02-07 15:26

    Executing this line of code after an AJAX call works for me:

    addthis.layers.refresh();

    Below is my setup for AddThis

    Script

    
    

    I put this code where I want AddThis to show

    How I do AJAX call

    var xhttp = new XMLHttpRequest();
    xhttp.onreadystatechange = function() {
        if (this.readyState === 4 && this.status === 200) {
    
            // Update the DOM
    
            if (typeof(addthis) != 'undefined' && addthis != null) 
                addthis.layers.refresh();
        }
    };
    xhttp.open("POST", "", true);
    xhttp.send();
    

    Result

提交回复
热议问题