I have an input of type text there is entered an id to verify if you existed or not.
list.forEach(function(a) {
if (b == a["id"]) {
g["setstatus"](true, a["id"], f);
return c(true)
alert("Correcto!");
}
g["setstatus"](false, null, f);
return c(false)
});
The data I receive within the foreach is JSON type
[
{"id":2,"email":"[email protected]","name":"User example 3","c":false},
{"id":2,"email":"[email protected]","name":"User example 2","c":false},
{"id":1,"email":"[email protected]","name":"User Example 1","c":false}
]
The problem is when verifying b == a["id"]
, in this case b is the variable that receives the value of the user.
When I put 3 or 2 in the input it does not recognize, but when I put 1 newly recognize, I know it's the foreach, I also did it this way:
a.forEach(function(a) {
if (b == a["id"]) {
g["setstatus"](true, a["id"], f);
alert("Correcto!");
return c(true)
}
});
g["setstatus"](false, null, f);
return c(false)
But unfortunately it did not work either.