title: AJAX not passing POST vars in IE7/IE8
body: <p>Please Note: answers along the lines of 'use jquery' or 'use (insert wellknown framework)' is not helpful. Frameworks such as jquery includes alot of extra code which is not nessary at all for what I am doing. 'But, you can include one from Google', yes that may be the case, but I prefer to keep to my own code. With that in mind, lets proceed to the problem....</p>
  
  <p>I have an ajax call which doesn't pass POST vars through on IE7/IE8, but only on odd occasions. It appears to be extremely random and the majority of the time it does work. </p>
  
  <p>I am had a look at jquery and cannot see much difference in the way it works compared to this custom one.</p>
  
  <p>Here is the ajax function:</p>
  
  <pre><code>function GetXmlHttpObject(handler){ 
    var objxml = null;
   if(handler==null) {
    handler = function() {}
   }
  
     var ProgID = ["Msxml2.XMLHTTP.6.0", "Msxml2.XMLHTTP.3.0","Msxml2.XMLHTTP", "Microsoft.XMLHTTP"];              
  
       try {  
           objxml = new XMLHttpRequest();  
       }  
       catch(e) {  
           for (var i = 0; i &lt; ProgID.length; i++){  
               try {  
                   objxml = new ActiveXObject(ProgID[i]);  
               }  
               catch(e) {  
                   continue;  
              }  
           }  
       } 
   objxml.onreadystatechange=handler;
  
       return objxml;  
  }
  </code></pre>
  
  <p>A function that calls the Ajax function would be like this:</p>
  
  <pre><code>function sample_ajax(object_type,object_id) {
   var d = new Date();
   var time = d.getTime();
   var url= MYSITEURL + "my_ajax_script.php?timestamp="+time;
  
   params = "object_type="+object_type+"&amp;object_id="+object_id;
   xmlHttp_comment_notifyreset = GetXmlHttpObject(sample_ajax_helper);//fails on safari 1
   xmlHttp_comment_notifyreset.open("POST", url , true);
  
   xmlHttp_comment_notifyreset.setRequestHeader("Cache-Control", "no-cache");
   xmlHttp_comment_notifyreset.setRequestHeader("Cache-Control", "no-store");
   xmlHttp_comment_notifyreset.setRequestHeader("Cache-Control", "must-revalidate");
   xmlHttp_comment_notifyreset.setRequestHeader("Cache-Control", "post-check=0");
   xmlHttp_comment_notifyreset.setRequestHeader("Cache-Control", "pre-check=0");
   xmlHttp_comment_notifyreset.setRequestHeader("If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT");
  
  
   xmlHttp_comment_notifyreset.setRequestHeader("Content-Type", "application/x-www-form-URLencoded");
   xmlHttp_comment_notifyreset.setRequestHeader("Content-Length", params.length);
   xmlHttp_comment_notifyreset.setRequestHeader("Connection", "close");
  
   xmlHttp_comment_notifyreset.send(params);
  }
  </code></pre>
  
  <p>I am had a look at jquery and cannot see much difference in the way it works compared to this custom one.</p>