AnsweredAssumed Answered

get rest service value to html text

Question asked by evansepa on Jan 29, 2016
Latest reply on Feb 9, 2016 by evansepa

Hi,

 

I couldn't find info on how to query a rest service to get a value and put it into text on a webpage . . . using js / html

 

The solution here seems straight forward

jQuery > REST > ParksFinder Bonus?

However I'm looking to grab just one item value... something like this

 

$(document).ready(function()  

    $.ajax ( { 

  type: 'GET'

  url: 'https://ww3.yorkmaps.ca/arcgis/rest/services/Transportation/YR_TrafficCameras/MapServer/0/query?where=LOCATIONID%3D **JSVARIABLE** &f=json'

  data: { get_param: 'value' }, 

  dataType: 'json'

  success: function (data) { $.each( data.features, function(index, element) { 

  $('classname').append($('<div>' + element.attributes.CAM_LOCATION + '</div>') );  } ); } } ); 

});

 

I think the success parameter configured correctly would give me something useful...?!

 

Any guidance would be greatly appreciated.

 

Cheers.

 

 

https://ww3.yorkmaps.ca/arcgis/rest/services/Transportation/YR_TrafficCameras/MapServer/0/query

Outcomes