7

Is it possible to handle a JSON response using plain Ajax (i.e. JavaScript, without JQuery)?

In this description: http://www.w3schools.com/ajax/ajax_xmlhttprequest_response.asp only Text and XML objects are mentioned, but how to handle a JSON respone?

I just want to use pure JavaScript, without any additional libraries.

This shows me the JSON respone:

console.log(xhttp.responseText);
1
  • 1
    Please use the search before you ask a new question. Commented Nov 1, 2015 at 20:20

1 Answer 1

6

You can use JSON.parse():

console.log(JSON.parse(xhttp.responseText));
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.