Hi,
I would like to know if it is possible to set the data-id with a variable so that I can dynamically retrieve and display profiles of different members.
- Log in to post comments
Hi,
I would like to know if it is possible to set the data-id with a variable so that I can dynamically retrieve and display profiles of different members.
Hi Jonathan,
You'd do something like this.
var id="http://www.linkedin.com/in/seitel";
var elm = document.getElementById('theProfileElement');
// ... set all the other data-* params you need
elm.setAttribute('data-id', id);
IN.parse(elm);
Hope that helps,
Jon
Could anyone else get this to work? After implementing the above recommendation, when I click on the MemberProfile it still comes back with the old, stale popup. When I print out the element though, the data-id has been set correctly; so it seems that the IN.parse is not working right.
Hey Saidaijagan:
Dynamically changing the script tag is not supported. You could try to wrap the script tag in a div and then set div.innerHTML = "" (thereby destroying old content) and adding new script tag and calling IN.parse() again.
Thanks
Steve
Sure, I'm doing this in ASP.Net by writing the script text to a label control as follows. In the example below the variable (CompanyName) is coming from a Gridview Control.
Label4.Text = "<script src='http://platform.linkedin.com/in.js' type='text/javascript'></script><script type=IN/CompanyProfile data-format='inline' width='306px' data-id='" & Replace(GridView4.Rows(0).Cells(1).Text, " ", "%20") & "'></script>"