【发布时间】:2015-10-30 11:47:32
【问题描述】:
我想做的是从名为data 的LinkedIn API 中从名为getProfileData 的函数中获取返回的数据。如何访问包含firstName 和lastName 等信息但在getProfileData 而不仅仅是在函数onSuccess 中的数据?
<script type="text/javascript" src="//platform.linkedin.com/in.js">
api_key: YOUR_API_KEY_HERE
authorize: true
onLoad: onLinkedInLoad
</script>
<script type="text/javascript">
// Setup an event listener to make an API call once auth is complete
function onLinkedInLoad() {
IN.Event.on(IN, "auth", getProfileData);
}
// Handle the successful return from the API call
function onSuccess(data) {
console.log(data);
}
// Handle an error response from the API call
function onError(error) {
console.log(error);
}
// Use the API call wrapper to request the member's basic profile data
function getProfileData() {
IN.API.Raw("/people/~").result(onSuccess).error(onError);
// I want to see the profile data in here.
}
</script>
【问题讨论】:
标签: javascript linkedin-api linkedin-jsapi