so if have following json
{ "data": { "sectionlist": { "section124": [{ "a": "test", "b": "test", "c": "test", "d": "test", "e": "test2013-04-14" }, { "a": "test", "b": "test", "c": "test", "d": "test", "e": "test2013-04-14" } ] }, "section00824": [ [{ "a": "test", "b": "test", "c": "test", "d": "test", "e": "test2013-04-14" }, { "a": "test", "b": "test", "c": "test", "d": "test", "e": "test2013-04-14" } ] ] } }
and ajax on within code , have callback returns result need know first section called
i know can this:
return result.data.sectionlist.section124; but problem dont know name can change every time
i tried
return result.data.sectionlist.*; return result.data.sectionlist[0]; but not allowed
any ideas?
thanks
if have 1 section, can name doing object.keys(result.data.sectionlist)[0]. however, if have more 1 section , want first, can't result object since objects in javascript don't preserve key ordering.
Comments
Post a Comment