i trying fetch objects main object. array in main object holds these other objects, can access first element calling 'odata.events.event[0]' loop through [1], [2], [3] , on.
//this works var collection = odata.events.event[0]; $("<li>description: " + collection.description + "</li>").appendto("#shower"); //this not work :( var collection = odata.events.event[0]; var output = "<ul>"; (var = 0; < collection.length; i++) { output += "<li>" + collection.description + "</li>"; $(output).appendto("#shower"); collection = collection + 1 //shift next array } output += "</ul>";
maybe use foreach loop
odata.events.event.foreach(function(result) { console.log(result); }); alternatively, try jquery's .each() function:
$.each(odata.events.event, function(index, value) { console.log( index + ": " + value ); }); edit: it's worth noting output of these calls object - still have access data beneath objects you've looped to!
Comments
Post a Comment