RETURN AJAX RESULT IN A DIV

Asked

Viewed 12 times

-2

How do I return the query result in a div

<script>

jQuery('document').ready(function() {
  jQuery('#submit').click(function() {

    var dados = jQuery(this).serialize();
    //aqui voce pega o conteudo do atributo action do form
    var url = $(this).attr('action');
    jQuery.ajax({
      type: "POST",
      url: "busca.php",
      data: dados,
      success: function(response) {
        //'response' é a resposta do servidor
        //alert(response);
         $("#div_delect").load("busca.php");
      }
    });

    return false;
  });
});
</script>



<div id="div_delect"></div>
  • Instead of $("#div_delect"). load("search.php"), put $("#div_delect"). html(Response);

  • I tried that friend, but now I click on search and does not return anything and I test straight without the normal ajax ta

  • in the search page.php I get the results with $_POST["search"]

  • The #Ubmit element called the click event, and you did jQuery(this). serialize(). What’s in #Ubmit that you’re Serializing? The tb error is in this. Probably #Submit is a button and you are Serializing the button instead of the form.

  • Got a friend Thank you very much!

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.