-1
Instead of using ajax for feedback, I’m seeing the jQuery function $.post
or $.get
.
But I can only return with an echo one column of the mysql table. ex.
echo $conteudo['id'];
With ajax playing the return coming from select (which can contain multiple lines) game all of the array and only caught in the answer.. echo json_encode($array);
How can I return an array that can contain multiple lines and take the function $.post
or $.get
?
ex.
$("#idInp").keyup(function(){
var idd = $("#idInp").val();
$.post('verifica.php',{id:idd},function(resposta){
$("#tex").empty();
if(resposta.trim() == $("#idInp").val() ){
$("#tex").append("nomes iguais");
}else{
$("#tex").append("nomes diferentes");
}
});
});
$seg = $pdo->prepare("SELECT * FROM usuarios WHERE name = :id");
$seg->bindValue(":id",$_POST['id']);
$seg->execute();
$v = $seg->fetch(PDO::FETCH_ASSOC);
echo $v['name'];
if I return only one line (echo $name['name']) will work , plus if I have 100 lines ? How can I do it equal to ajax .. build a loop and go through the resposta[cont].name
.. resposta[cont].idade
.. at last..