0

If doing console.log(data) from inside a function that get passed the result of an AJAX request outputs

in the google chrome developer tools, I am wondering how I can get to the value of result? I think the entire response is being interpreted as a string? normally I would just use the dataType parameter, but I do not have control over this AJAX request.

2
  • How is the JSON fetched? Commented Nov 19, 2012 at 1:30
  • It's part of the PLupload library so however that fetches it, I assume it's just a jQuery ajax request. this is the event binding for FileUploaded aka ` uploader.bind('FileUploaded', function (up, file, data) {...}` Commented Nov 19, 2012 at 1:34

2 Answers 2

2

data.response property contains an object that is serialized to JSON, so you have to unserialize it in this way:

var response = JSON.parse(data.response),
    result = response.result;
Sign up to request clarification or add additional context in comments.

1 Comment

Thank you, I had tried JSON.parse(data) but of course, that didn't work! your's does, so shall accept asap.
1

You're trying to parse the JSON:

 var data = JSON.parse(obj.response);

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.