【问题标题】:LinkedIn Javascript API not returning Position(end-date)LinkedIn Javascript API 不返回位置(结束日期)
【发布时间】:2012-10-19 13:05:22
【问题描述】:

由于某种原因,职位的 endDate 正在挂起整个脚本?

function importJobsEducation() {
  IN.API.Profile("me")
    .fields(["id","positions:(company,title,summary,start-date,end-date,is-current)", "educations","skills", "headline"])
    .result(function(result) {
      profile = result.values[0];

      $("#headline").val(profile.headline);
      $("#linkedInID").val(profile.id)

    positions = "";
for (var index=0; index < profile.positions.values.length; index++) {

    JobTitle = profile.positions.values[index].title
    jobSummary = profile.positions.values[index].summary
    isCurrent = profile.positions.values[index].isCurrent
    JstartMDate = profile.positions.values[index].startDate.month
    JstartYDate = profile.positions.values[index].startDate.year

    alert(profile.positions.values[index].endDate.month)

    if (isCurrent === false) {

        }

// Company Fields


OrgName  = profile.positions.values[index].company.name
companyType = profile.positions.values[index].company.companyType
size = profile.positions.values[index].company.size
industry = profile.positions.values[index].company.industry
ticker = profile.positions.values[index].company.ticker



}

    education = "";
for (var index=0; index < profile.educations.values.length; index++) {
    schoolName = profile.educations.values[index].schoolName    
    startDate = profile.educations.values[index].startDate.year
    EndDate = profile.educations.values[index].endDate.year

}

skills = "";    
for (var index=0; index < profile.skills.values.length; index++) {
skills += '<a href="" class="tag">'+ profile.skills.values[index].skill.name + '</a>&nbsp;';
}


    });
}

【问题讨论】:

  • 脚本挂在哪里?是否产生任何错误?
  • alert(profile.positions.values[index].endDate.month)部分挂起脚本没有错误?

标签: jquery ajax json api linkedin


【解决方案1】:

您的代码的问题是当前位置没有结束日期,并且您的代码编写方式试图获取当前位置的 endDate。

因此,我建议你有一个条件标签来检查这个位置是否是当前的,如果不是,它会获取结束日期。示例:

if (profile.positions.values[index].isCurrent === false) {
       endDate = profile.positions.values[index].endDate.month;
    }

我希望这会有所帮助。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-05-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多