title: get specific div content from responseText and save source code into a database
body: <p>I'm trying to get a specific div content including all the elements of another page from responseText</p>
  
  <p>the body of the html file looks like this:</p>
  
  <pre><code>&lt;div id="div_1"&gt;
      &lt;div&gt;&lt;h1&gt; Title 1 &lt;/h1&gt;&lt;/div&gt;
      &lt;div&gt;&lt;img src="blah1.jpg" /&gt;&lt;/div&gt;
      &lt;div&gt;&lt;p&gt; Lorem Ipsum &lt;/p&gt;&lt;/div&gt;
  &lt;/div&gt;
  &lt;div id="div_2"&gt;
      &lt;div&gt;&lt;h1&gt; Title 2 &lt;/h1&gt;&lt;/div&gt;
      &lt;div&gt;&lt;img src="blah2.jpg" /&gt;&lt;/div&gt;
      &lt;div&gt;&lt;p&gt; Lorem Ipsum &lt;/p&gt;&lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>here is my function to get the source code of the entire html page:</p>
  
  <pre><code>function getSourceCode() {
      var xmlhttp;
      if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
          xmlhttp = new XMLHttpRequest();
      }
      else {// code for IE6, IE5
          xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
      }
  
      xmlhttp.onreadystatechange=function(){
          if (xmlhttp.readyState==4 &amp;&amp; xmlhttp.status==200){
              var source_code = xmlhttp.responseText;
              alert(source_code);
          }
      }
      xmlhttp.open("GET","test.html",true);
      xmlhttp.send(); 
  }
  </code></pre>
  
  <p>my question now is how to get only the source code for the "div_1" element. I want to save this source code into a database. I tried to use getElementbyId("div_1") but it didn't work.</p>