Note that there are some explanatory texts on larger screens.

plurals
  1. POTrying to pull location info on first connection in linkedin with javascript api
    primarykey
    data
    text
    <p>I have working code for pulling my connections info from Linkedin. However, whenever I try to pull location I get strange results.</p> <p>This code works but you will see 'object OBJECT' where location is supposed to be.</p> <pre><code>&lt;html lang="en"&gt; &lt;head&gt; &lt;title&gt;LinkedIn Industries&lt;/title&gt; &lt;script type="text/javascript" src="http://platform.linkedin.com/in.js"&gt; api_key: xxxxxxx onLoad: onLinkedInLoad scope: r_network,r_emailaddress,r_fullprofile,r_basicprofile,r_contactinfo &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;p&gt;This example demonstrates how to retrieve a user's connections. It also uses the LinkedIn auth events (load, login, logout) to control behavior.&lt;/p&gt; &lt;!-- NOTE: be sure to set onLoad: onLinkedInLoad --&gt; &lt;script type="text/javascript"&gt; function onLinkedInLoad() { IN.Event.on(IN, "auth", function() {onLinkedInLogin();}); IN.Event.on(IN, "logout", function() {onLinkedInLogout();}); } function onLinkedInLogout() { setConnections({}, {total:0}); } function onLinkedInLogin() { // here, we pass the fields as individual string parameters IN.API.Connections("me") .fields("id", "firstName", "lastName", "pictureUrl", "publicProfileUrl","location:(name)") .result(function(result, metadata) { setConnections(result.values, metadata); }); } function setConnections(connections) { var connHTML = "&lt;ul&gt;"; for (id in connections) { connHTML = connHTML + "&lt;li&gt;&lt;a href=\"" + connections[id].publicProfileURL + "\"&gt;"; /* picture url not always there, must be defensive */ if (connections[id].hasOwnProperty('pictureUrl')) { connHTML = connHTML + "&lt;img align=\"baseline\" src=\"" + connections[id].pictureUrl + "\"&gt;&lt;/a&gt;"; } else { connHTML = connHTML + "&lt;img align=\"baseline\" src=\"http://static02.linkedin.com/scds/common/u/img/icon/icon_no_photo_80x80.png\"&gt;&lt;/a&gt;"; } connHTML = connHTML + "&amp;nbsp;&lt;a href=\"" + connections[id].publicProfileUrl + "\"&gt;"; connHTML = connHTML + connections[id].firstName + " " + connections[id].lastName + "&lt;/a&gt;"; connHTML = connHTML + " (Location: " + connections[id].location + ")&lt;/li&gt;"; } connHTML = connHTML + "&lt;/ul&gt;"; document.getElementById("connectionsdata").innerHTML = connHTML; } &lt;/script&gt; &lt;script type="IN/Login"&gt; &lt;div id="connectionstest"&gt; &lt;p&gt;Current User's Connections:&lt;/p&gt; &lt;div id="connectionsdata"&gt;&lt;/div&gt; &lt;/div&gt; &lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>The main issue really exists in location, in the documentaion this should be replaced with location.name, however, whenever I do this I get nothing back, although I can see that there is a XHR response with a json, which has:</p> <p>location:{"name":"Dublin etc"}</p> <p>Please help solve the mystery of the hidden location</p> <p>EDIT: 5/23/2013- In Chrome's Developer tools I can see a message saying (Uncaught TypeError: Cannot read propertry 'name' of undefined - hopes this help someone help me</p> <p>When I look in the console of the chrome developer, there is more detail on the above uncaught type error: Uncaught TypeError: Cannot read property 'name' of undefined linkedconnect.html:55</p> <p>setConnections linkedconnect.html:55</p> <p>(anonymous function) linkedconnect.html:36 Sslac.Class.Constructor.Method.Method.Method.Method.Method.Method.Method.Method.Method.Method.Method.Method.Method.Method.Method.Method.Method.b framework:3242</p> <p>(anonymous function) framework:173</p> <p>Sslac.Class.Constructor.Method.Method.Method.Method.Method.Method.Method.Method.Method.Method.Method.Method.Method.Method.Method.Method.Method.Method.Method.storedFailureResults framework:3247</p> <p>(anonymous function) framework:173</p> <p>g framework:3135</p> <p>pub.incoming framework:801</p> <p>_window_onMessage framework:566</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload