windows auth AGS service to html table

08-13-2018 01:37 PM
Occasional Contributor

I would like to create a simple html table from a windows auth secured arcgis service.

I tried implementing JSON (from Feature Layer Query) to html table however I cant figure out consuming a secured service.

- The ags service is public facing with windows authentication

- The html page I'm creating is behind our firewall, so I can embed credentials if necessary.

The problem I get with the code below is simply (401 unauthorized) on the rest service url... strangely if I open this url in a new tab it I get the json no problem. 

I was playing with various scenarios of a token embedded in the url parameters with no success...

Any help would be appreciated. I plan to use this functionality a lot...



<!DOCTYPE html>

 <title> Json to table using Ajax Jquery getJSON</title>
 <script src=""></script>
 <script src=""></script>
 <link rel="stylesheet" href="" />
 <script src=""></script>

 <div class="container">
 <div class="table-responsive">
 <h1> Cem Records</h1>
 <br />
 <table class="table table-bordered table-striped" id="cem_table">
 <th>First Name</th>
 <th>Last Name</th>


 $(document).ready(function() {
 function(data) {
 var cem_data = '';;
 $.each(data.features, function(key, value) {
 cem_data += '<tr>';
 cem_data += '<td>' + value.attributes.PLOTID + '</td>';
 cem_data += '<td>' + value.attributes.FIRST_NAME + '</td>';
 cem_data += '<td>' + value.attributes.LAST_NAME + '</td>';
 cem_data += '<tr>';
0 Kudos
0 Replies