2 Replies Latest reply on Mar 9, 2009 12:06 PM by Bj_flash

    asp onLoad not working in Browser

    Bj_flash Level 1
      I have an interesting problem. I have access to an existing asp code(store locator) that I can access with a URL here: http://www.marshallsonline.com/xml.asp?zip=02210&dept=cub where zip is the zipcode and dept is optional. this returns the three closest stores to a given zip code. I don't have control of this script. I need to pass in the zipcode and get the result which is an xml file. I tried everything I can think of and loadVars has given me nothing. I thought I was on to something with this code(below) that gets the result and parses the xml all neat 'n clean running local, but when I put it on the server it fails to load. I have verified that my domain has been added to their crossdomain.xml file. Anyone want a stab at this?

      // this code requires a dynamic textfield named "result_ta"

      System.security.allowDomain(" http://www.marshallsonline.com");
      var lv:XML = new XML();
      lv.ignoreWhite = true;
      lv.load(" http://www.marshallsonline.com/xml.asp?zip=02210&dept=cub");
      _root.da = [];

      lv.onLoad = function(success:Boolean) {
      result_ta.text = this.status+" "+this.toString();
      if(success){
      var xnRoot:XMLNode = this.firstChild;
      var xnItem:XMLNode;
      for(var i:Number = 0; i < xnRoot.childNodes.length; i++) {
      xnItem = xnRoot.childNodes ;
      this["downloadItemsArray"+i] = new Array();
      for(var j = 0; j < xnItem.childNodes.length; j++) {
      this["downloadItemsArray"+i][j] = xnItem.childNodes[j].firstChild.nodeValue;
      }
      _root.da.push(this["downloadItemsArray"+i]);
      }
      loadLocations();
      } else {
      trace("Error");
      result_ta.text = this.status+", "+this.loaded+", "+this+", fail";
      }
      };

      function loadLocations() {
      var tempText:String = "";
      for(var m = 0; m < _root.da.length; m++) {
      tempText += "\n";
      if(_root.da[m][0] != undefined) {
      tempText += _root.da[m][0] + "\n";
      } else {
      tempText += "\n";
      }
      if(_root.da[m][1] != undefined) {
      tempText += _root.da[m][1] + "\n";
      }
      tempText += _root.da[m][2] + ", " + _root.da[m][3] +" " +_root.da[m][4] +"\n";
      if(_root.da[m][5] != undefined) {
      tempText += "Phone: "+_root.da[m][5];
      }
      tempText += " \n";
      }
      result_ta.text = tempText;
      }