JavaScript运行时错误:TypeError:无法获取未定义或空引用的属性“length”
在调用上述函数时获取一个错误的长度 什么是错误??!JSON.parseresults.responseText.CircleQuestion的类型是什么?在results变量中发布内容错误是0x800A139E-JavaScript运行时错误:类型错误:无法获取未定义或空引用@Java_userJSON的属性“length”类型是JsonArray@user2182397JavaScript运行时错误:TypeError:无法获取未定义或空引用的属性“length”,javascript,apache-cordova,Javascript,Apache Cordova,在调用上述函数时获取一个错误的长度 什么是错误??!JSON.parseresults.responseText.CircleQuestion的类型是什么?在results变量中发布内容错误是0x800A139E-JavaScript运行时错误:类型错误:无法获取未定义或空引用@Java_userJSON的属性“length”类型是JsonArray@user2182397 var getPatientQuestions = function(apiURL, $scope, callback)
var getPatientQuestions = function(apiURL, $scope, callback) {
azureauthetication.invokeApi(apiURL, {
body: null ,
method: "GET"
}).done(function (results) {
var PatientQuestions = (JSON.parse(results.responseText)).CircleQuestion;
var questionContent = "";
for(i=0;i<PatientQuestions.length;i++) {
var question = PatientQuestions[i].question;
var answer = PatientQuestions[i].answer;
questionContent = questionContent + '<div class="bubble-right">' + question + '</div> <div class="time-right">4.44pm</div>';
if(answer != null){
questionContent = questionContent + '<div class="bubble-left">' + answer + '</div> <div class="time-right">4.44pm</div>';
}
}
callback(questionContent);
}, function (error) {
hideBusy();
});
};