I'm using a plugin called vuukle on wordpress and load a comment section. Inside that section I need to replace an image url. But seems like code is not working without any error. This is my code,
$('.bXLoAM').each(function (i, obj) {
var str = obj.href;
str = str.replace("https://api.vuukle.com/stats/External?source=talk_of_town&url=", "");
str = str.replace("https://api.vuukle.com/stats/External?source=talk_of_town&url=", "");
$.getJSON('http://www.whateverorigin.org/get?url=' + encodeURIComponent(str) +
'&callback=?',
function (data) {
console.log(data.contents);
var s = data.contents;
var htmlObject = $(s);
$(obj.querySelector('img')).attr("src", htmlObject.find('.attachment-single_thumb')[0].src);
});
});
And below is the code in iframe with parent div. And think iframe is loaded with ajax via plugin.
<div id="vuukle-comments" class="commentBoxDiv" style="display: flex;flex-direction: column;width: 100%;align-items: stretch;">
<div class="vuukle-ads" style="display: block; height: auto; margin: 10px auto; text-align: center; clear: both; width: 100%; max-width: 100%; overflow: hidden;">
<div id="div-gpt-ad-1497448474263-1" data-google-query-id="CLSC6ZfJz-MCFQoZcgodPH8Fow">
<div id="google_ads_iframe_/213794966/vuukle-widget/lankabusinessonline.com_0__container__" style="border: 0pt none;"><iframe id="google_ads_iframe_/213794966/vuukle-widget/lankabusinessonline.com_0" title="3rd party ad content" name="google_ads_iframe_/213794966/vuukle-widget/lankabusinessonline.com_0" scrolling="no" marginwidth="0" marginheight="0" style="border: 0px none; vertical-align: bottom;" srcdoc="" data-google-container-id="1l" data-load-complete="true" width="300" height="0" frameborder="0"></iframe></div>
</div>
</div>
<iframe src="https://cdn.vuukle.com/widgets/index.html?apiKey=mykey&host=lankabusinessonline.com&articleId=135613&author=LBO&img=&lang=en&tags=ETL%20Colombo%20denies%20claims%20as%20the%20importer%20of%20waste%20cargo%2C%20lbo%2C%20lbo.lk&title=&url=https%3A%2F%2Fwww.lankabusinessonline.com%2Fetl-colombo-denies-claims-as-the-importer-of-waste-cargo%2F&color=%23108ee9&darkMode=false&emotesEnabled=true&firstImg=&secondImg=&thirdImg=&fourthImg=&fifthImg=&sixthImg=&d=false&realtime=false&l_d=false&totWideImg=false&link=https%3A%2F%2Fwww.%5Burl%5D&hideArticles=false&maxChars=3000&commentsToLoad=5&toxicityLimit=80&spamLimit=90&gr=false&hideCommentBox=false&hideCommentBoxWithButton=false&wpSync=false&fAuth=true&gAuth=true&tAuth=true&dAuth=false&vuukleAuth=false&passwordAuth=false" style="width: 100%; min-width: 100%; overflow: hidden; order: 1; height: 731px;" name="v-comments" id="v-comments" scrolling="no" height="0" frameborder="0"></iframe>
</div>