javascript - Pass an argument as a reference to get a JSON property -


i'm working on facebook app js sdk...

i want create function makes api call graph api:

this got:

function a(reference){     fb.api('/me', function(respond){                      var = respond.reference[0].name;          alert(it);     }); } 

i try executing way doesn't work.

a("inspirational_people"); 

so you’re feeding text string "inspirational_people" function, , want access property of response object having name?

that’s quite easy, basic javascript syntax: every property can access via object.propertyname can access object["propertyname"].

so in case, since want access response.inspirational_people[0].name, it’s response[reference][0].name – actual string value of reference evaluated @ runtime, , should end having wanted.


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -