title: Refresh jQuery code after AJAX request
body: <p>Let's say, for example, that I have some buttons that calls AJAX requests when clicked.</p>
  
  <pre><code>$(document).ready(function(){
      $('button').each( function() {
          $(this).click( function() {
                      alert('Clicked.');
              // ...AJAX request...
          });
      });
  });
  </code></pre>
  
  <p>When I click on a button, everything works fine.</p>
  
  <p>But if I load the buttons with an AJAX request and then I click on them, the code above stops working.</p>
  
  <p>How can I get rid of this?</p>
  
  <p>I have tried the <code>on()</code> method</p>
  
  <pre><code>$(document).ready(function(){
      $('button').each( function() {
          $(this).on('click', function() {
                      alert('Clicked.');
              // ...AJAX request...
          });
      });
  });
  </code></pre>
  
  <p>But it's just the same. Works normally, doesn't work on AJAX-loaded content.</p>
  
  <p>I'm stuck, please help me.</p>
  
  <p>P.S.: I am using the latest version of jQuery (v1.7.1).</p>