title: TypeError: Cannot read property 'open' of undefined (Phonegap and Ionic)
body: <p>I'm building a mobile app using Phonegap Build and Ionic. I am trying to make an XMLHttpRequest to a web service to get some XML data. The web service requires 3 parameters. I keep getting the following error:</p>
  
  <blockquote>
    <p>ionic.bundle.js:26794 TypeError: Cannot read property 'open' of
    undefined.</p>
  </blockquote>
  
  <p>Any ideas as to what I might be doing wrong?</p>
  
  <p>I have attached the entire method below. </p>
  
  <pre><code>$scope.result = function callService(requestAction, requestXML){
  
    var httpObj = undefined; 
  
    if(window.XMLHttpRequest){    
      httpObj = new XMLHttpRequest();    
    }    
    else if (window.ActiveXObject){    
      httpObj = new ActiveXObject("Microsoft.XMLHTTP"); 
    }
  
    if(httpObj = undefined){
      alert("Failed creating Http Object");     
      return ""; 
    }
  
    if(requestAction == undefined || requestAction == null){
      requestAction = "";    
    }
  
    var async = false; 
    var url = "theurl";     
    var systemID = "thesystemid";     
    var requestAction = "GetEnquiry"; 
    var requestXML = "therequestxml"; 
    var params = "SystemID=" + systemID + "&amp;RequestAction=" + requestAction + "&amp;RequestXML=" + requestXML + "&amp;OutputFormat=JSON";            
    var headers = "Content-type , application/x-www-form-urlencoded; charset=UTF-8"; 
  
    httpObj.open("POST", url, async);                 
    httpObj.send(params);
  
    if(httpObj.readyState == 4 &amp;&amp; httpObj.status == 200){
      var result = httpObj.responseText; 
      console.log("This is the result: " + result);    
      return result; 
    }    
    else {    
      var result = httpObj.responseText;     
      return result; 
    }   
  };   
  })
  </code></pre>