var featLayerURL = "http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/TaxParcel/AssessorsLiveLayers/MapServer/1"; var featLayer = new esri.layers.FeatureLayer(featLayerURL); alert(featLayer.fields.length);
The error returned is:
TypeError: featLayer.fields is undefined.
At first I thought it was something wrong with one of my server's layers, but after using that sample server and getting the same error, I'm sure there is something else wrong.
Here is a link to the REST response: Layer: Recorded Tax Parcel Sales (ID: 1).