title: Does Ajax automatically refresh the DOM after Jquery sends post?
body: <p>I just started to work with Ajax and I'm not totally lost... not sure how does it really works.</p>
  
  <p>I thought Ajax sends (by example a post) to the server and returns x data but that data is automatically added to the DOM (without reloading the page). I have the following jquery ajax script:</p>
  
  <pre><code>$.ajax({
      method: "POST",
      url: "/url",
      data: { 
          'varname': varname, 
          'varname2': varname2
          // etc
      }
  });
  
  return false;
  </code></pre>
  
  <p>I just learned (but somehow I already was expecting this...) that what it returns is inside data and it's not synced with the browser (current) DOM or html. I did an alert(data) and saw the whole new html compiled code:</p>
  
  <pre><code>}).done(function(data) {
      alert(data);
  });
  
  return false;
  </code></pre>
  
  <p>The question is: how am I supposed to add what I need from data to the current html. I mean if the variables sent triggers a new script (and new content is generated) how do I put the new content, refreshing or updating the old one?</p>