title: Where to use parser.parse in arcgis js api
body: <p>I have a code using <strong>ArcGIS</strong> js API and <strong>RequireJS</strong>.
  I got error <strong>k.isXdUrl is not a function</strong> when I evaluate <code>parser.parse();</code></p>
  
  <p>Here is my code:</p>
  
  <pre><code>require.config({
      paths: {    
          'esri'      :   'http://js.arcgis.com/3.12/esri',
          'dojo'      :   'http://js.arcgis.com/3.12/dojo',
          'dojox'     :   'http://js.arcgis.com/3.12/dojox',
          'dijit'     :   'http://js.arcgis.com/3.12/dijit',
          'jquery'    :   'http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min',
          'app'       :   'app'
      }
  });
  
  require([
      'jquery',
      'dojo/parser',
      'dijit/layout/BorderContainer', 'dijit/layout/ContentPane'
  ], function($, parser){
      require(['app'], function(){
          $(document).ready(function(){
              parser.parse(); //IS IT PROPER PLACE FOR THIS?
              var PARKI_APP = new MapApplication();
              $.getJSON(PARKI_APP.CONFIG_FILE, function(json){
                  if (json.app)       PARKI_APP.initApp(json.app);
                  if (json.map)       PARKI_APP.initMap(json.map);
                  if (json.widgets)   PARKI_APP.initWidgets(json.widgets);
              });
          });
      });
  });
  </code></pre>
  
  <p>I guess the problem is caused by <code>initMap</code> function because it loads other modules asynchronously. Here is code of <code>initMap</code> function:</p>
  
  <pre><code>initMap: function(json){
          var config = {
                  center : json.center || this.prototype.appDefaults.center,
                  zoom : json.zoom || this.prototype.appDefaults.zoom,
                  featureLayers: json.featureLayers
              },
              id = this.prototype.MAP_HTML_ID,
              app = this;
  
          require([
              'esri/map',
              'esri/tasks/GeometryService',
              'esri/toolbars/edit',
  
              'esri/layers/ArcGISTiledMapServiceLayer',
              'esri/layers/FeatureLayer',
  
              'dojo/dom',
              'dijit/layout/BorderContainer', 'dijit/layout/ContentPane'
          ], function(
              Map, GeometryService, Edit,
              ArcGISTiledMapServiceLayer, FeatureLayer,
              dom
          ) {
              var map,
                  layers = config.featureLayers,
                  featureLayers = [];
  
              //This service is for development and testing purposes only. We recommend that you create your own geometry service for use within your applications. 
              esriConfig.defaults.geometryService = new GeometryService("http://tasks.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer");            
  
              map = new Map(id, {
                  basemap: "streets",
                  center: config.center,
                  zoom: config.zoom
              });
  
              var labels = new ArcGISTiledMapServiceLayer("http://server.arcgisonline.com/ArcGIS/rest/services/Reference/World_Boundaries_and_Places/MapServer");
              map.addLayer(labels);
              //feautre layers
              for (var i = 0, l = layers.length; i &lt; l; i++) {
                  var fLayer = new FeatureLayer(layers[i].url, {
                      mode: FeatureLayer.MODE_ONDEMAND,
                      outFields: ['*']
                  });
                  featureLayers.push(fLayer);
              };
              map.addLayers(featureLayers);
              app.setMapParams(config);
              app.setMap(map);
          })
  
      },
  </code></pre>
  
  <p>And here is some portion of <strong>HTML</strong>:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
      &lt;head&gt;
          &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8"&gt;
          &lt;!--The viewport meta tag is used to improve the presentation and behavior of the samples 
            on iOS devices--&gt;
          &lt;meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"&gt;
          &lt;link rel="stylesheet" href="http://js.arcgis.com/3.14/esri/css/esri.css"&gt;
          &lt;link rel="stylesheet" href="css/custom_style.css"&gt;
          &lt;script data-main="main.js" src="libs/require.js"&gt;&lt;/script&gt;
      &lt;/head&gt;
      &lt;body class="claro"&gt;
          &lt;div id="main" data-dojo-type="dijit/layout/BorderContainer" data-dojo-props="design:'headline'"&gt;
              &lt;div class="panes" data-dojo-type="dijit/layout/ContentPane" id="header" data-dojo-props="region:'top'"&gt;
                  &lt;p&gt;AAA&lt;/p&gt;
              &lt;/div&gt;
              &lt;div id="leftPanes" class="panes" data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region:'left'" style="width: 210px;overflow:hidden;"&gt;
              &lt;/div&gt;
              &lt;div data-dojo-type="dijit/layout/ContentPane" id="map" data-dojo-props="region:'center'"&gt;&lt;/div&gt;
          &lt;/div&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Do you see any problem with my code?</p>
  
  <p>Thanks.</p>