Can the Member Profile Plugin "data-id" be set with a variable?

9 posts / 0 new
Last post
Jonathan Schacter's picture
Joined: 06/29/2011
Sun, 07/17/2011 - 05:39
Can the Member Profile Plugin "data-id" be set with a variable?

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.

Joined: 07/16/2011
Tue, 07/19/2011 - 02:41

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>"

Joined: 07/16/2011
Tue, 07/19/2011 - 02:42

Aghh they remove the Script :) Basically you need to write the script as a string to a label control and edit the variable within the string

Neil D Ferguson's picture
Joined: 08/22/2011
Tue, 08/23/2011 - 05:16

Hey, did you get a solutio for this, i have tried to do this dynamically but cannot get it to work
Thanks

Jonathan Seitel's picture
Developer Advocate
Joined: 02/03/2011
Tue, 08/23/2011 - 13:21

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

Will Fredette's picture
Joined: 08/18/2011
Thu, 09/22/2011 - 04:23

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.

Jeremy Johnstone's picture
Developer Advocate
Joined: 04/17/2011
Thu, 09/22/2011 - 16:00

Hi Will,

That doesn't work for me either. I will follow up with Jon and the team to find out if that's a bug or if there was a missing step in his instructions.

-Jeremy

saidaijagan jagan's picture
Joined: 12/05/2011
Thu, 02/16/2012 - 01:11

any solutions ? i m using in php

Steven Citron-Pousty's picture
Joined: 08/02/2011
Thu, 02/16/2012 - 08:16

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