Hi Guys!

I am trying to use LinkedIn API to authenticate a user and get their member info to prefill a registration form.

Here's the code I am using:

Code HTML4Strict:
<script type="text/javascript" src="http://platform.linkedin.com/in.js">
  api_key: 92b7wk2jrrfl
  onLoad: onLinkedInLoad
  authorize: true
</script>
 
function onLinkedInLoad() {
	IN.Event.on(IN, "auth", onLinkedInAuth);
}
function onLinkedInAuth() {
	IN.API.Profile("me").result(displayProfiles);
}
function displayProfiles(profiles) {
	member = profiles.values[0];
	document.getElementById("first_name").value = member.firstName;
	document.getElementById("last_name").value = member.lastName;
}

It's filling in my data but I have to refresh the page first for the data to be loaded. Is there some option to do this automatically?