title: how to get html from xmlhttprequest
body: <p>It difficult to me<br>
  I try to use <code>xmlhttprequest level 2</code>.
  I trying to get html from url and display in div tag <code>id=mydiv</code>.
  I creating <code>123.php</code> and run it in <em>xampp</em></p>
  
  <pre><code>  &lt;script&gt;
      function createCORSRequest() {
          var xhr = new XMLHttpRequest();
          if ("withCredentials" in xhr) {
              xhr.open("get", "http://www.ebay.com", true);
          } else if (typeof XDomainRequest != "undefined") {
              xhr = new XDomainRequest();
              xhr.open(method, url);
          } else {
              xhr = null;
          }
          return xhr;
      }
    &lt;/script&gt;
  </code></pre>
  
  <p>and code function getpage()</p>
  
  <pre><code>    function getpage() {
      var request = createCORSRequest();
        if (request) {
          request.onload = function() {
              document.getElementById("myDiv").innerHTML = xmlhttp.responseText;
          };
          request.send();
        }
      }
  </code></pre>
  
  <p>code html</p>
  
  <pre><code>&lt;button type="button" onclick="getpage()"&gt;Request data&lt;/button&gt;
  &lt;div id="myDiv"&gt;&lt;/div&gt;
  </code></pre>
  
  <p>How can i get the html code from it. </p>
  
  <p>and how to add header xmlhtmlrequest</p>
  
  <pre><code>Host: www.ebay.com
  User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Firefox/31.0
  Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
  Accept-Language: vi-vn,vi;q=0.8,en-us;q=0.5,en;q=0.3
  Accept-Encoding: gzip, deflate
  </code></pre>
  
  <p>Can somebody help me solve problem?</p>