0
Returns a alert
empty when I use this code (I picked it up on the internet):
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.js"></script>
<script src="http://malsup.github.com/jquery.form.js"></script>
<script>
$(document).ready(function()
{
$(".busca").keyup(function()
{
var busca = jQuery(".busca").val();
if(busca.length >= 1)
{
jQuery.ajax(
{
type: "POST",
url: "resultado.php",
dataType: "html",
data: "busca=" + busca,
success: function(response)
{
jQuery("#retorno").html(response);
},
error: function(request, status, erro)
{
alert("Problema ocorrido: " + status + "\nDescição: " + erro);
alert("Informações da requisição: \n" + request.getAllResponseHeaders());
}
});
}
});
});
</script>
Good morning, The error may be happening because of the return type, if it is not returning a partial in HTML... for this the method in your code also needs to be returning HTML , if your code is returning a JSON, it would have to be dataType: "JSON" ... and so on...?
– Herbert Junior