获取LinkedIn返回来自Javascript SDK的数据

时间:2015-09-07 15:47:23

标签: javascript linkedin-api linkedin-jsapi

我想要做的是从名为data的函数中获取名为getProfileData的LinkedIn API的返回数据。如何在firstName中访问包含lastNamegetProfileData等信息的数据,而不仅仅是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>

1 个答案:

答案 0 :(得分:0)

您必须在代码中修改一些内容:

{
  displayName: 'Qty',
  name: 'Quantity',
  width: '10%',
  type: 'number',
  headerCellClass: 'partsListGridHeader',
  cellTemplate: '<div ng-if="!row.groupHeader"><input id="{{row.entity.PartNumber}}" type="number" ng-change="vm.SelectedProduct.IsConfigurationSaved = false;" size="4" ng-maxlength="4" class="partsListQuantity" ng-class="{ \'autoConfigured\': row.entity.IsAutoConfigured }" style="width:50px;" min="{{row.entity.MinValue}}" max="{{row.entity.MaxValue}}" step="1" ng-pattern="/^[0-9]*$/" ng-model="row.entity.Quantity" ng-readonly="row.entity.IsAutoConfigured" /></div>',
  aggregationType: uiGridConstants.aggregationTypes.sum,
}