javascript - Reading Dynamic JSON Array -
i trying build javascript function grab json encoded array , return value based on requested key. use jquery $.parsejson() method take json string , convert javascript object. here watered down example:
function getvalue(dynamicarraykey) { var thearray = $.parsejson(/* json source using jquery */); alert('here value: ' + thearray.dynamicarraykey); } so key want given function, , should return resulting value. thinking javascript eval() method should used in there somewhere, i'm not sure. appreciated.
there's no need eval(), use
alert('here value: ' + thearray[dynamicarraykey]);
Comments
Post a Comment