0
In php I have the following return:
$invalido = (object) array(
'invalido' => true
);
echo json_encode($invalido);
and I need to show on success
of ajax
asked if the invalido
is true
.
I tried the following:
success: function(data) {
//alert(data);
if(data.invalido == true)
{
alert('invalido');
}
}
It is not entering the if, and the top Alert is displaying the following:
{"invalido":true}{"scalar":false}
How valid what’s coming in invalido
?
I need to access what’s coming in this json
, access the invalido
:
{"invalido":true}{"scalar":false}
Thank you. I am already receiving a json and need only validate the
invalido
of this json.– SM_S
@SM_S put two ways in how you can access the invalid key value and make its due validations.
– Netinho Santos
Is showing this error by the second way:
Cannot use 'in' operator to search for 'length' in {"invalido":true}{"scalar":false}
– SM_S
Any more suggestions?
– SM_S