In my console log the array look like this:
{"userid":"5502","fullname":"My fullname","email":"[email protected]","user_access":"real"}
Now on my ajax, I have a handle code for the data array that the server sends to the app:
function handleData(responseData) {
var access = responseData;
console.log(access);
if (access == '"real"') {
alert("Welcome");
location.href = "home.html";
} else {
alert("Your username and password didn\'t match.");
}
}
How I can get the specific value of this "user_access":"real" in array and use it in condition.
like this:
if (access == '"real"') { // What should be the format of access variable?
alert("Welcome");
location.href = "home.html";
}
responseData.access === 'real'Property accessorsto access the property ofobjectaccessproperty, when you actually wanted theuser_accessproperty.