Error: Unable to get value of property 'apply': object is null or undefined

3 posts / 0 new
Last post
Mey Meenakshisundaram's picture
Joined: 02/20/2012
Mon, 02/20/2012 - 13:44
Error: Unable to get value of property 'apply': object is null or undefined

I tried out the simple example of displaying user profile info but getting the below in IE9 ( after logging into my linkedaccount and grant access to the application)

Line : 1020
Error :"Unable to get value of property 'apply': object is null or undefined "

In FireFox 11, it's not even displaying the linkedin button

<html>
<head>
<title>Network Sreaming App Example</title>
<script type="text/javascript" src="http://platform.linkedin.com/in.js">
api_key: key goes here
authorize: true
</script>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link media="all" type="text/css" href="http://developer.linkedinlabs.com/tutorials/css/jqueryui.css" rel="stylesheet"/>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.5b1.js" />
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.7/jquery-ui.min.js" />
<script type="text/javascript">
function loadData() {
IN.API.Profile("me")
.fields(["id", "firstName", "lastName", "pictureUrl", "headline"])
.result(function (result) {
profile = result.values[0];
profHTML = "<p><a href=\"" + profile.publicProfileUrl + "\">";
profHTML += "<img class=img_border align=\"left\" src=\"" + profile.pictureUrl + "\"></a>";
profHTML += "<a href=\"" + profile.publicProfileUrl + "\">";
profHTML += "<h2 class=myname>" + profile.firstName + " " + profile.lastName + "</a> </h2>";
profHTML += "<span class=myheadline>" + profile.headline + "</span>";
$("#profile").html(profHTML);
});
}
</script>
</head>
<body class="yui3-skin-sam yui-skin-sam">
<div id="profile">
</div>
<script type="IN/Login" data-onAuth="loadData"></script>
</body>
</html>

Jeremy Johnstone's picture
Developer Advocate
Joined: 04/17/2011
Tue, 02/21/2012 - 20:23

Try doing it without the []'s around the fields() parameters. Not sure if that's related, but could be one possibility (yes, I know how docs show it that way, and I will fix them if that's the issue).

-Jeremy

Eugene O&#039;Neill's picture
Developer Advocate
Joined: 01/07/2011
Wed, 02/22/2012 - 21:36

According to the HTML spec <script> tags aren't allowed to be self closing. Make sure you have a proper closing </script> tag.

1
2
<script type="text/javascript" src="http://code.jquery.com/jquery-1.5b1.js" />
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.7/jquery-ui.min.js" />

Webkit browsers will support them, but most others choke on them.

That might not be the fix to your issue, but it's one place to start.