title: javascript Uncaught TypeError: Cannot call method 'getElementsByTagName' of null
body: <p>In <code>Prestashop</code> I am using alphabitical search module. When I installed the module on my prestashop theme<code>(1.5.0.17)</code> I got an error like </p>
  
  <pre><code>Uncaught TypeError: Cannot call method 'getElementsByTagName' of null 
  </code></pre>
  
  <p>Here is the code for jQuery file</p>
  
  <pre><code>function initXMLHTTPRequest()
  {
  var xmlHttp = null;
    try 
    {
      // Firefox, Opera 8.0+, Safari
      xmlHttp = new XMLHttpRequest();
      }
      catch (e)
       {
             // Internet Explorer
              try 
              {
                  xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
              }catch (e)
               {
                  xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
              }
         }
       return xmlHttp;
  }
  function getProdList(id,langid)
  {
      var xmlHttp=initXMLHTTPRequest();
      var str = "value="+id+"&amp;langid="+langid;
      var span="";
      var url = "modules/alphabetsearch/PHP/searchDetails.php?";
          xmlHttp.onreadystatechange=function()
          {
                    if(xmlHttp.readyState==4 )
                    {
                        span=span+"&lt;ul style='padding-bottom:20px;'&gt;&lt;li&gt;&lt;b&gt;"+id+"&lt;/b&gt;&lt;/li&gt;";
                        var xmldata=xmlHttp.responseXML;
                        var xmlObj = xmldata.getElementsByTagName("ProductDetails")[0];
                        var menusize= xmlObj.childNodes[0].childNodes[0].childNodes[0].nodeValue;
                        var xmlObjlength = xmlObj.childNodes.length;
                        for(var i=1;i&lt;xmlObjlength;i++)
                          {
                          var ProductName=xmlObj.childNodes[i].childNodes[0].childNodes[0].nodeValue;
                          var productId=xmlObj.childNodes[i].childNodes[1].childNodes[0].nodeValue;
                          span=span+"&lt;li  style='line-height:20px;display:block;height:20px;list-style:none;border-bottom:1px solid #666666;'&gt;&lt;a href='product.php?id_product="+productId+"'&gt;&lt;div&gt;"+ProductName+"&lt;/div&gt;&lt;/a&gt;&lt;/li&gt;"
                          }
                          if(xmlObjlength==1)
                          {
                              document.getElementById("products").innerHTML="";
                              document.getElementById("products").innerHTML="No Products Under this Alphabet";
                          }
                          else{
                          document.getElementById("products").innerHTML="";
                          span=span+"&lt;/ul&gt;";
                          document.getElementById("products").innerHTML=span;
                          }
                    }
          };
           xmlHttp.open("POST",url,true); 
           xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
           xmlHttp.setRequestHeader("Content-length", str.length);
           xmlHttp.setRequestHeader("Connection", "close");
           xmlHttp.send(str);
  }
  </code></pre>
  
  <p>Can someone kindly tell me how to solve this issue? Any help and suggestions will be really apprecaible. Thanks</p>
  
  <p>The live site can be found <a href="http://www.secretperfumes.com/" rel="nofollow">here</a> </p>