deleted-user-ugCMpXci8bn5

not extracting values correctly from URL

Discussion created by deleted-user-ugCMpXci8bn5 on Aug 30, 2012
Latest reply on Sep 20, 2012 by deleted-user-ugCMpXci8bn5
Hello,

I am trying to create a URL from the current extent (and including other parameters), and then be able to extract that extent from the URL and zoom to that extent on opening the app, with a default extent if there are no parameters in the URL.

What I am getting instead is an empty map when I load a URL with parameters.  I am not getting any errors in Firebug.  Below is the relevant code:

(to extract parameters:)
    
    var urlToObject = locale.substring(locale.indexOf("?") + 1, locale.length);    
    var testURLExtent;    
    urlToObject = dojo.queryToObject(urlToObject);
  
  if ( urlToObject.urlxmin != null) 

  { 
   alert ("passed in extent from url");
  
   var locXmin = urlToObject.urlxmin;
   var locYmin = urlToObject.urlymin;
   var locXmax = urlToObject.urlxmax;
   var locYMax = urlToObject.urlymax;

  }
  
  else
  {
   alert ("no params, preset extent");
   var locXmin = 896338.273119375;
   var locYmin = 116730.668986593;
   var locXmax = 1089315.70367493;
   var locYMax = 274621.293986593;
  }
  
  var testURLExtent = new esri.geometry.Extent (locXmin, locYmin, locXmax, locYMax,  new esri.SpatialReference({ wkid: 2263}));


(and to create URL, from a new extent:)
    var curExtent = {
   urlxmin: pointExtent.xmin,
   urlymin: pointExtent.ymin,
   urlxmax: pointExtent.xmax,
   urlymax: pointExtent.ymax,
   
    };
    
          var url = "http://127.0.0.1:8020/MyApp/index.html";
    var queryStr = dojo.objectToQuery(curExtent);
    url= url + "?" + queryStr;
    alert (" url: " + url);



I notice that if I use only one parameter (such as xmin), and set the rest to constant values. the value is passed correctly from the URL, making me think there is a problem with the parsing of the parameters at the '&' sign?
Any help would be appreciated, thanks //

Outcomes