我正在尝试从主对象中获取对象。主对象中的数组包含 这些其他对象,我可以通过调用'oData.events.event[0]
'来访问第一个元素,但是我想循环获取[1], [2], [3]
等等。我正在尝试从主对象中获取对象
//this works
var collection = oData.events.event[0];
$("<li>description: " + collection.description + "</li>").appendTo("#shower");
//this does not work :(
var collection = oData.events.event[0];
var output = "<ul>";
for (var i = 0; i < collection.length; i++)
{
output += "<li>" + collection.description + "</li>";
$(output).appendTo("#shower");
collection = collection + 1 //shift to next array
}
output += "</ul>";