错误
TypeError: response[i] is undefined
...box' class='selectedSubjects' name='selectedSubjects' />
</td><td class='selected...
大批
[{"S_Code":"BCS-CER-IS","S_Name":"Information Systems.","C_Code":"BCS-CER","S_Status":"Active"},
{"S_Code":"BCS-CER-SD","S_Name":"Software Development.","C_Code":"BCS-CER","S_Status":"Active"},
{"S_Code":"BCS-CER-TEC","S_Name":"Computer & Network Technology","C_Code":"BCS-CER","S_Status":"Active"}]
AJAX 成功回调
success: function (response) {
var size = response.filter(function (value) {
return value !== undefined
}).length;
for (var i = 0; i <= size; i++) {
$("#subjectsTable tr:last").after("<tr class='success' data-index=" + (i + 1) + "><td><input type='checkbox' class='selectedSubjects' name='selectedSubjects' /></td><td class='selectedSCode'>" + response[i].S_Code + "</td><td class='selectedSName'>" + response[i].S_Name + "</td></tr>");
}
}
为什么这个 response[i] 是未定义的?