I am having trouble storing the response of my XHR request.
Here is the javascript so far:
var req = new XMLHttpRequest;
req.open('get', 'https://jsonplaceholder.typicode.com/todos', true);
req.responseType = 'json';
req.send();
Over at chrome dev tools, i can see that response is the items i want so request should be fine. It is status of 200 and state 4.
The problem becomes when i try to write
var myJSON = req.response;
When i log this to console it responds with "null". But if i reassign the value through dev tools, to exactly the same value, i get my JSON object.. Can someone please explain to me why and how i can fix this?