jquery - Get value from JSON string -


i have following json string:

{"d":"{\"foo\":7,\"bar\":5,\"foobar\":3}"} 

and corresponding invocation in js file:

$.getjson("foo.svc/getsomefoo", function (response) {             alert(response["foo"]);             alert(response["bar"]);             alert(response["foobar"]);         }); 

just trying write out values, can't seem out. simple, not finding helpful while googling it.

your json has embedded json. need do:

var d = json.parse(response.d); alert(d.foo); ... 

Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -