When getJSON, does not find it what is returned? I'm leaving like it does, but it's not right.
$("#email").focusout(function() {
emailDigitado = $("#email").val();
$.getJSON("inc_verificaCadastro.php", {email:emailDigitado}, function(json){
if (json[0].email == ''){
$('#divSenha').attr('class', 'mostrar');
$("#senha").attr("required", true);
}else{
$("#id_cadastro").val(json[0].id_cadastro);
}
});
});
file inc_verifyCadastro.php
<?php
header('Content-Type: application/json; charset=utf-8');
include 'config.php';
$rs = $conexao->query("SELECT ID_Cadastro, email FROM cadastro WHERE email = '".$_GET['email']."' ");
$Array = Array();
while($row = $rs->fetch_assoc()) {
$Array[] = Array(
"email" => $row['email'],
"id_cadastro" => $row['ID_Cadastro']
);
}
$json_encode = json_encode($Array);
echo $json_encode;
?>