13 Replies Latest reply on Sep 9, 2010 6:00 PM by Catalin Anastasoaie

    XMLHttpRequest works in preview but not in install

    OfficeDude

      I work with Dreamweaver CS5 and preview the HTTP/Javascript Adobe Air application as I create the code.

       

      The application is now in a state that I figured I'd compile the application, install it, and test it.  One problem, one call, which authenticates me to an API fails.

       

      I was hoping that someone could point out the error in my ways.  I'm thinking it's a security thing but can't figure it out.

       

      The code I use is as follows:

       

      ----------------------------------------------

       

      var url = "http://open-api.domain.com/authentication.getUserToken.domain";
      var vars = "v=3&appKey="+appKey+"&email="+email+"&password="+password;  

       

      var domainCOM = new XMLHttpRequest();
      domainCOM.open("POST", url, true);
      domainCOM.setRequestHeader ("Content-type", "application/x-www-form-urlencoded");
      domainCOM.setRequestHeader ("Content-length", vars.length);
      domainCOM.setRequestHeader ("Connection", "close");

       

      domainCOM.onreadystatechange = function() {     
          if (domainCOM.readyState == done) {
              if (domainCOM.status == ok) {
                  if (domainCOM.responseText) {
                  //do some stuff
                  }
                  else {
                      window.alert('unknown error in authenticationGetUserToken.');
                  }
              }
              else {               
                  window.alert('Password / Userid combination is not valid.  Please correct and try again.');
              }     
          }
      };
      domainCOM.send(vars);
      return;

       

      It works perfectly and hits the //do some stuff code every single time in preview mode.  It always hits the 'password /userid' combination error when I'm running the application.

       

      Any help would be apreciated.