title: Moving from using innerHTML for an AJAX response. (Code is not getting a response)
body: <p>I am currently using the code as seen below but it is insecure and can be used to exploit the website using XSS.</p>
  
  <p>Old Code, that works:</p>
  
  <pre><code>document.getElementById('response').innerHTML = xmlHTTP.responseText;
  </code></pre>
  
  <p>New code that is giving no response:</p>
  
  <pre><code>var divContent = xmlHTTP.responseText;            
    var getRes = document.getElementById('response');
    if (getRes.innerText) {
        getRes.innerText = divContent; //For Safari, Google Chrome and MSIE.
    }
    else
    if (getRes.textContent) {
        getRes.textContent = divContent; //For Firefox.
      }   
  }
  </code></pre>
  
  <p>The basic HTML Div below:</p>
  
  <pre><code>&lt;div id="response"&gt;&lt;/div&gt;
  </code></pre>
  
  <p>Furthermore the output is HTML, not text. </p>