title: Jquery how to execute commands appended with ajax
body: <p>I'm loading the content of a document into a div when I click one item of the menu. This foreign document contains jQuery commands. But is not running.</p>
  
  <pre><code>    $(document).ready(function() {    
      $("ul.subnav li a").click(function() {
              link = $(this).attr("href");
              $.ajax(link).done(function(data) {
                  $("#div-page").html(data);
              });
  
              return false;
          });
  });
  </code></pre>
  
  <p>In the document that will be loaded there is more jQuery commands like this:</p>
  
  <pre><code> $(document).ready(function() {
  
          // get lista de estados
          $.ajax("../php/get_lista_estados.php").done(function(data) {
              $("#estados").append(data);
          });
  
          $("#estados").change(function() {
              id = $(this).val();
              // get lista de estados
              $.ajax("../php/get_lista_municipios.php?id=" + id).done(function(data) {
                  $("#municipios").html(data);
              });
          });
  
      });
  </code></pre>
  
  <p>But when I load this document into div the commands don't run. Do I speak clear?</p>