似乎无论我尝试什么,我最终都会遇到这个错误。我尝试过默认示例:
<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/~:(firstName)?format=json").result(onSuccess).error(onError);
}
</script>
我只是试图将用户的第一个名称作为测试进行控制。我还尝试了各种函数名称,以及删除onLoad
参数只是为了测试。我总是收到错误:Uncaught TypeError: Cannot read property 'apply' of undefined.
答案 0 :(得分:0)
看起来您在定义之前尝试使用onLinkedInLoad
,尝试交换<script>
块顺序。