I am loading dynamically content on my web site and I need to create social media buttons after the ajax function, when i get necessary information. I found great solutions for facebook and twitter, but I can't find the working solution for linkedin. Hope my question is clear... Thanks in advance for smart answers!
EDIT: I found a solution.
var din ='<script id="holderLink" type="IN/Share" data-url="http://kitchenprague.com/news.php?id='+val.id+'" data-counter="right"></script>';
$(".linkedinDetail").html(din);
IN.parse();
The full solution as stated by hjuster is...
var din ='<script id="holderLink" type="IN/Share" data-url="http://kitchenprague.com/news.php?id='+val.id+'" data-counter="right"></script>';
$(".linkedinDetail").html(din);
IN.parse();
But let me provide some explanation, because explanation is great!
Build a script tag to hold your share URL data...
var din ='<script id="holderLink" type="IN/Share" data-url="http://kitchenprague.com/news.php?id='+val.id+'" data-counter="right"></script>';
Simply append the URL data to the page...
$(".linkedinDetail").html(din);
According to the Official LinkedIn Documentation, "In order to reload the widget on a single page application, use in.parse()," so...
IN.parse();
Hope this helps someone out there!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With