AnsweredAssumed Answered

jQuery / REST - Generate HTML Page

Question asked by bokeefe on May 1, 2015
Latest reply on May 1, 2015 by rscheitlin

Example

User visits a web page called 'Parks List'. A list of Parks is populated from the REST service with the name of each Park as an HTML Link that goes to the ParksFinder map TO THAT PARK.

Question

Let's assume that I have the ParksFinder application running and going smooth. We developed the Feature ID field to be the first 3 letters in the name of the Park, a hyphen, and the first 3 digits in the address.

 

For instance, Darlington Park is located at 5179 East 29th Street South.

The Feature ID for Darlington Park is Dar-517.

The URL that jumps you DIRECTLY to that Park is: http://maps.cityoftulsa.org/parksfinder/?selectedFeatureID=Dar-517

 

These are all things pulled from the REST service which is located at:

http://maps.cityoftulsa.org/gis/rest/services/LGDM/Parks/MapServer/0

 

Current Test

I have a tiny amount of experience with jQuery and REST. Other than my work with WAB, it is actually very little. Enough that this is going over my head right now. So I went out to get some working samples of REST with jQuery to see if I couldn't hobble together a basic concept. Here is what I have (that doesn't work) at the moment.

 

// hello.js
// MapServer: http://maps.cityoftulsa.org/gis/rest/services/LGDM/Parks/MapServer/0
// Feature Servcer: http://maps.cityoftulsa.org/gis/rest/services/LGDM/Parks/FeatureServer/0
$(document).ready(function() {
    $.ajax({
        url: "http://maps.cityoftulsa.org/gis/rest/services/LGDM/Parks/MapServer/0"
    }).then(function(data) {
       $('.greeting-id').append(data.name);
    });
});

 

index.html
<!DOCTYPE html>
<html>
    <head>
        <title>Hello jQuery</title>
        <script src="../../js/jquery-1.11.2.min.js"></script>
        <script src="hello.js"></script>
    </head>


    <body>
        <div>
            <p class="greeting-id">The Park name is </p>
        </div>
    </body>
</html>

 

It's not doing anything. I can't tell if I need to pass a query? And if so, what would that query be? (1=1) or something similar? How should I format it best? I feel like if I am going to populate a page with ALL 100+ Parks from our ArcGIS Server that I need to reformat my jQuery, but I'm not 100% sure how.

 

I shouldn't have to worry about cross-domain scripting because this is on the same server as all our webmaps.

http://maps.cityoftulsa.org/jsdev/RESTTEST/

 

Confused but hopeful. There are a plethora of pages on our City site that would benefit GREATLY from something like this.

 

Any help would be greatly appreciated.

Outcomes