don007

N00b question: How am I triggering a TypeError within the API?

Discussion created by don007 on Sep 20, 2012
Latest reply on Sep 26, 2012 by don007
Raw beginner here, trying to figure this out. I am attempting to create a FeatureLayer object; at this point, simply creating it and adding it to a map object is all I'm shooting for. Here's my whole script:


<script type="text/javascript" src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=3.1"></script>

<script type="text/javascript">

dojo.require("esri.map");
dojo.require("esri.layers.FeatureLayer");

function init ( )
{
 var startExtent = new esri.geometry.Extent
 (
  -460735.08683161414 // bottom x
  ,109870.9884550733 // left y
  ,605952.1265091426 // top x
  ,521356.80020335224 // right y
  ,new esri.SpatialReference ({wkt : "GRS_1980"})
 );

 var map = new esri.Map ("map", {extent : startExtent, fitExtent : true});

 var features = new esri.layers.FeatureLayer
 (
  "http://gis-app.bucknell.edu:6080/arcgis/rest/services/Pilot_FeatureAccess/MapServer"
  ,{mode : esri.layers.FeatureLayer.MODE_SNAPSHOT, outFields : ["*"]}
 );
 map.addLayers ([features]);
}

dojo.addOnLoad (init);

</script>


When I load the page, the console is showing two TypeErrors being thrown within the API. I don't even know where to begin looking for the problem at my level of inexperience.

Outcomes