1

出于某种原因,职位的 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;';
}


    });
}
4

1 回答 1

1

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

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

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

我希望这有帮助。

于 2012-10-25T10:33:00.753 回答