How to perform ajax but not update content from div so add?

Asked

Viewed 41 times

0

I have a <div> where the function return ajax and returned, however it updates, I want to know if you have how to perform the function ajax and instead of updating it bring the result leaving the old result, it is possible?

HTML

<div id="id">

</div>

Ajax

  $.ajax({
         url:'enviar.php',
         method:'POST',
         data:{nome:nome, texto:texto},
         beforeSend: function(){
          $("#id").html("...");
         }
         success:function(data){
          $("#id").html(data)
         }

        });
  • I could post how your code is so far?

  • From the page that sends ajax or receives?

  • 4

    Probably $("#id").append(data) will already solve

  • Solved another doubt if I put a beforeSend $("#id"). append("...") the 3 points also stays as I do not to stay the 3 points?

  • @abfurlan adds his reply for me to put as answered.

1 answer

1


You just need to change $("#id").html(data) for $("#id").append(data).

Browser other questions tagged

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