title: Uncaught TypeError: Cannot set property 'innerHTML' of null
body: <p>Working with Ajax... I cannot seem to figure out what is wrong here. The error occurs on the code: <strong>objUserID.innerHTML = username;</strong>. It thinks the variable <strong>username</strong> is null. <strong>username</strong> does have data in it because the following code confirms it: <strong>console.log("user: ["+username+"]");</strong> Can anyone figure this out?</p>
  
  <pre><code>function actionBid(bidID,bidA,bidAction){
     var XMLHttpRequestObject = false;
  
     if (window.XMLHttpRequest)
     {
        // code for IE7+, Firefox, Chrome, Opera, Safari
        XMLHttpRequestObject = new XMLHttpRequest();
     }
     else if (window.ActiveXObject) 
     {
        // code for IE6, IE5
        XMLHttpRequestObject = new ActiveXObject("Microsoft.XMLHTTP");
     }
     if(XMLHttpRequestObject)
     { 
        // ==== GET BID ====
        if (bidAction == "getbid"){
  
        var objUserID = document.getElementById("curBidUser"+bidID); 
        var res = XMLHttpRequestObject.responseText;
        var username = res.substring(0,res.indexOf(','));
        console.log("user: ["+username+"]");
        objUserID.innerHTML = username;
        }
     }
  }
  </code></pre>