Chaitanya Desai Chaitanya Desai - 1 year ago 70
jQuery Question

Issue with sharing image and description via AddThis plugin in every social site

This is my code:

$('#sharethis').attr('addthis:url', "<?php echo base_url(); ?>" + "research_science/Details/" + returnedData.research_id);
$('#sharethis').attr('addthis:title', returnedData.research_name);
$('#sharethis').attr('addthis:description', returnedData.research_desc);
$('#sharethis').attr('addthis:media', "<?php echo base_url(); ?>" + returnedData.research_logo);

addthis.update('share', 'url', "<?php echo base_url(); ?>" + "research_science/Details/" + returnedData.research_id);
addthis.update('share', 'title', returnedData.research_name);
addthis.update('share', 'description', returnedData.research_desc);
addthis.update('share', 'media', "<?php echo base_url(); ?>" + returnedData.research_logo);
addthis.update('share', 'url', "<?php echo base_url(); ?>" + "research_science/Details/" + returnedData.research_id);

$(".addthis_toolbox .addthis_counter").replaceWith('<a class="addthis_counter addthis_bubble_style"></a>');
addthis.counter('.addthis_counter', null, {url: "<?php echo base_url(); ?>" + "research_science/Details/" + returnedData.research_id});


I used also used
og:image
property in header, but that works only for Facebook, not for other social site.

Thank you.

Answer Source

Google, Facebook and twitter like all social website just read source code of website. Social website not run your client-side js script; you need generate this type of tags in server side(via PHP script).

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download