javascript - How to get a property in a dynamically created Object in a dynamically created Array -


basically, have dynamically created object being sent php script put array. store it's located in array in tools user uses select view property in object want get.

example:

object{   property1: string   property2: int   property3: object{                  innerobjproperty1: array                  innerobjproperty2: string              }   property4: object{                  innerobjproperty1: array                  innerobjproperty2: string              }   property5: object{                  innerobjproperty1: array                  innerobjproperty2: string              } } 

and 1 object inside array

array={object1, object2} 

and array populated dynamically based on user input.

now, if wanted grab innerobjproperty1 in array object1 know do

array[object1].property3.innerobjproperty1 

but, problem there that, since it's user based, point in array , property being selected user. value inside inner object same selected (innerobjproperty1 it's array of values want see), property of object dependent upon select box.

i have selects set there's id tied them has array location , property name, know of no short hand way quick select object based on variable. example:

var thesplit= $(this).attr("id").split("|"); var arrayitem = thesplit[0]; var objproperty = thesplit[1]; alert(array[arrayitem].objproperty.innerobjproperty1; 

would never work. there short hand method? or should have use function loop through each item of property find 1 equals objproperty? sorry if seems simple, feel i'd rather use short hand if possible , can't think of one. looping through object in array isn't hard, want see if there's simpler method either javascript or jquery


Comments

Popular posts from this blog

Change php variable from jquery value using ajax (same page) -

Pull out data related to my apps from Android Play Store and iOS App Store -

How can I fetch data from a web server in an android application? -