title: get DOM element from AJAX response with JavaScript
body: <p>I have an AJAX request that returns a chunk of HTML as a response that is inserted into a div.  How can I use JavaScript to get an element of DOM from that AJAX response HTML?  I have JavaScript at the end of the returned HTML response div, but getElementById returns null,  apparently because the DOM hasn't been created, and I can't use window.onload like on a normal web page.  See eample below.  And this has to be in JavaScript - no libraries. </p>
  
  <pre><code>&lt;div class="page-content extractAjaxContent" id="tableContent_AJAX"&gt;
  &lt;div id="name"&gt;Biff&lt;/div&gt;
      &lt;html:form action="/variableCostStatusPost" method="post"&gt;
       ....some JSP to produce HTML
      &lt;/html:form&gt;
  &lt;script&gt;console.log("Name is " + document.getElementById('name'));&lt;/script&gt;
  &lt;/div&gt;
  </code></pre>