这是我的代码。如何在回调函数中获取 for 循环的值。我需要在回调中访问 gradableGBItems[i].Title
for(var i=0; i < gradableGBItems.length ; i++)
{
//console.log(gradableGBItems[i].isGradable);
//console.log(gradableGBItems[i].id);
var resultItem='';
Title=gradableGBItems[i].title;
//console.log(Title);
//console.log(gradableGBItems[i].id);
gradeBookbRestService.loadGradeBookItemByItemId(token, gradableGBItems[i].id, function(resultItem) {
//Console.log(); //Need to access value
if(resultItem.grade != null || resultItem.grade != undefined)
{
//console.log(resultItem.points);
jsonObj.push({id:resultItem.grade.id, comments:resultItem.grade.comments, isVisible:resultItem.grade.isVisible, letterGrade:resultItem.grade.letterGrade, points: resultItem.grade.points, title: Title } );
console.log(jsonObj);
}
});
}