Displaying Feature Layer Field Values on webpage without Map using ArcGIS API for JavaScript

I am just learning JavaScript for this mini-project.

I am looking to display the field values from a service feature layer on a web page using HTML and JS without loading a map and without any input or action from the user.

Service Feature Layer:


What I’ve been working with so far is below from reading through tutorials and forums, but I can’t get it working:

<!DOCTYPE html>
 <script src=""></script>
 <script src=""></script>
 <link rel="stylesheet" href="" />
 <script src=""></script>

 <div class="container">
 <div class="table-responsive">
 <h1> Trails! </h1>
 <br />
 <table class="table table-bordered table-striped" id="data_str">
 <th>Trail Name</th>


 $(document).ready(function() {
 function(data) {
 var data_str = '';;
 $.each(data.features, function(key, value) {

 data_str += '<td>' + value.TRL_NAME + '</td>';
 data_str += '<tr>';

Geographic Information Systems Asked on November 12, 2021

1 Answers

One Answer

The first problem is with the query string you're sending to the server.

If you scroll down on the Feature Layer's endpoint you'll see a Query link, which is the endpoint for requesting data.

Set the where clause to 1=1 if you want to return all records, or use a SQL query such as TRL_NAME like 'M%' to find all records starting with "M":

enter image description here

Set the outFields parameter to * to return all fields, or use a comma-delimited list of the desired fields.

Change the Format option to json to return the results in JSON format, and you'll have the correct syntax for the query:*&returnGeometry=false&f=json

The second problem is that you need to look at the attributes parameter of the value object, in order to get the name of the trail:

$.each(data.features, function(key, value) {

I put together a rough demo at to demonstrate some of these changes. Open the Console option and see that it's found Medea Creek trail:

enter image description here

It still doesn't add the results to your table, but you could look at for some pointers. I hope this helps get you started.

Answered by Stephen Lead on November 12, 2021

Add your own answers!

Related Questions

overpass api too many requests

0  Asked on March 24, 2021


How to keep same extent for my 10 raster files?

1  Asked on March 24, 2021 by ali-rawail


Finding the minimum spanning tree (MST)

1  Asked on March 24, 2021 by liap307


Extracting Values from Multidimensional Raster

0  Asked on March 24, 2021 by lizzie-jane


RTKLIB PPP algorithm against Single point poisitioning

1  Asked on March 24, 2021 by paulzaba


Area calculation

1  Asked on March 23, 2021 by vinay-dhanvada


How to group and count attribute data?

5  Asked on March 23, 2021 by seren SyntaxError

1  Asked on March 23, 2021 by brentiemapper


QGIS How to label individual sides of polygon

3  Asked on March 23, 2021 by bad-loser


Raster to ASCII -9999 for all cells!

0  Asked on March 23, 2021 by bianca


Ask a Question

Get help from others!

© 2021 All rights reserved.