I' currently learning AJAX technology.
In Chrome console when I type jsonObject.responseText
, I get all data in the console, but when I do the same in my .js
file to print that to the console (or HTML element) it says "undefined"
in the console.
JSON object is from:
https://jsonplaceholder.typicode.com/users
Code in JavaScript:
var jsonObject = $.ajax({
url: "https://jsonplaceholder.typicode.com/users",
dataType: "json"
});
console.log(jsonObject.responseText);