title: Ajax , xhr.responseXML.getElementsByTagName() don't worked on chrome and IE but worked on firefox
body: <p>I'm a ajax beginner. I'm trying to write a simple search suggestion. When I use firefox test It worked, but when I use chrome  I got that:  <strong>Uncaught TypeError: Cannot read property 'getElementsByTagName' of null</strong> </p>
  
  <p>I wrote this on the callback function </p>
  
  <pre><code>xhr.onreadystatechange = function () {
      if (xhr.readyState === 4 &amp;&amp; xhr.status === 200) {
          var data = xhr.responseXML;
          var x = data.getElementsByTagName("suggestion");
          var div = document.getElementById("suggest")
          div.innerHTML = "";
          showSuggest();
          for (var i = 0; i &lt; x.length; i++) {
              var result= x[i].firstChild.nodeValue;
              div.innerHTML += "&lt;div id='sResult' onmouseover='over(this)' onmouseout='out(this)' onclick='replace(this)' &gt;"
                  + result+ "&lt;/div&gt;";
          }
      }
  }
  </code></pre>
  
  <p>and this on Servlet doGet method:</p>
  
  <pre><code> protected void doGet(HttpServletRequest request, HttpServletResponse response)
              throws ServletException, IOException {
          response.setContentType("test/xml;charset=UTF-8");
          response.setHeader("Cache-Control", "no-cache");
          response.setHeader("Pragma", "no-cache");
          String keyword = request.getParameter("keyword");
  
          //get suggestion from  db
          List&lt;KeyWord&gt; kw = SearchService.suggest(keyword);
          PrintWriter pw = response.getWriter();
          pw.println("&lt;?xml version='1.0' encoding='UTF-8'?&gt;");
          pw.write("&lt;suggestions&gt;");
          for(KeyWord k:kw){
              pw.write("&lt;suggestion&gt;");
              pw.write(k.getContent());
              pw.write("&lt;/suggestion&gt;");
          }
          pw.write("&lt;/suggestions&gt;");
          pw.flush();
          pw.close();
      }
  </code></pre>