I am trying to get an object from inside a JSON but I can't. It only gives me undefined
.
But when I check the result on the console it gives me the right results.
Here is my JSON
{
users: [
{
userID: "151",
userFirstname: "first",
userMiddlename: "middle",
userLastname: "latname",
userAddress: "qewasd",
userContactNumber: "123456",
userRole: "role",
userName: "user",
userPassword: "pass",
userEmail: "test@gmail.com",
userPitch: "Very good",
userExperience: "5",
userFirm: "Sample",
userRollNo: "0"
}
]
}
and here is my javascript
$(document).ready(function () {
$.getJSON('http://batz.web/Sandbox/details.php?userID=151', function (results){
document.getElementById("title").innerHTML = results.userID;
console.log(results);
});
});