user2766267
user2766267

Reputation: 57

issue in getting a value of Json or object in javascript

I have a variable like this:

{ "Text" : "
            Name:        Useraafsdf
            available       Usef50d0fc138d9r213123
            loggedout       0 

" } 

and I want to get the value of text. but when I write: console.log(Response.Text); I get "undefined". How can I get the value? although I am taking this Response from here: Response = messageObj.responseText; So Maybe this "Text" is an object and not a json.

Upvotes: 0

Views: 27

Answers (1)

xdazz
xdazz

Reputation: 160833

messageObj.responseText is a string, you have to parse it.

var Response = JSON.parse(messageObj.responseText);

Upvotes: 2

Related Questions