I am trying to access the results of the following URL in my Javascript code. The result returned is a JSON, and I'm trying to get the x and y results of that JSON.
Here is the URL:
https://jcgis.jacksongov.org/arcgis/rest/services/Utilities/Geometry/GeometryServer/project?inSR=102698&outSR=4326&geometries=%7B%0D%0A++%22geometryType%22+%3A+%22esriGeometryPoint%22%2C%0D%0A++%22geometries%22+%3A+%5B%0D%0A+++++%7B%0D%0A+++++++%22x%22+%3A+2806540.74997300%2C+%0D%0A+++++++%22y%22+%3A+1036617.12483400%0D%0A+++++%7D%0D%0A++%5D%0D%0A%7D&transformation=&transformForward=true&vertical=false&f=html
It would use GET which returns the following object:
https://jcgis.jacksongov.org/arcgis/rest/services/Utilities/Geometry/GeometryServer/project?inSR=102698&outSR=4326&geometries=%7B%0D%0A++%22geometryType%22+%3A+%22esriGeometryPoint%22%2C%0D%0A++%22geometries%22+%3A+%5B%0D%0A+++++%7B%0D%0A+++++++%22x%22+%3A+2806540.74997300%2C++++++++%22y%22+%3A+1036617.12483400%0D%0A+++++%7D%0D%0A++%5D%0D%0A%7D&transformation=&transformForward=true&vertical=false&f=pjson
I will actually have variables for the lat, long coordinates, but let's leave that hard-coded for the moment.
I have tried all sorts of methods of trying to grab the x and y results but nothing's worked. Currently I have an ajax call like this:
<SPAN class="keyword token">var</SPAN> lat<SPAN class="punctuation token">,</SPAN> long<SPAN class="punctuation token">,</SPAN> temp<SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">var</SPAN> url <SPAN class="operator token">=</SPAN> <SPAN class="string token">"https://jcgis.jacksongov.org/arcgis/rest/services/Utilities/Geometry/GeometryServer/project?inSR=102698&outSR=4326&geometries=%7B%0D%0A++%22geometryType%22+%3A+%22esriGeometryPoint%22%2C%0D%0A++%22geometries%22+%3A+%5B%0D%0A+++++%7B%0D%0A+++++++%22x%22+%3A+2806540.74997300%2C++++++++%22y%22+%3A+1036617.12483400%0D%0A+++++%7D%0D%0A++%5D%0D%0A%7D&transformation=&transformForward=true&vertical=false&f=pjson"</SPAN><SPAN class="punctuation token">;</SPAN>
$<SPAN class="punctuation token">.</SPAN><SPAN class="token function">ajax</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">{</SPAN>
dataType<SPAN class="punctuation token">:</SPAN> <SPAN class="string token">'json'</SPAN><SPAN class="punctuation token">,</SPAN>
type<SPAN class="punctuation token">:</SPAN> <SPAN class="string token">"GET"</SPAN><SPAN class="punctuation token">,</SPAN>
url<SPAN class="punctuation token">:</SPAN> url<SPAN class="punctuation token">,</SPAN>
success<SPAN class="punctuation token">:</SPAN> <SPAN class="keyword token">function</SPAN><SPAN class="punctuation token">(</SPAN>jsonobject<SPAN class="punctuation token">)</SPAN>
<SPAN class="punctuation token">{</SPAN>
temp <SPAN class="operator token">=</SPAN> JSON<SPAN class="punctuation token">.</SPAN><SPAN class="token function">parse</SPAN><SPAN class="punctuation token">(</SPAN>jsonobject<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
lat <SPAN class="operator token">=</SPAN> temp<SPAN class="punctuation token">.</SPAN>geometries<SPAN class="punctuation token">.</SPAN>x<SPAN class="punctuation token">;</SPAN>
long <SPAN class="operator token">=</SPAN> temp<SPAN class="punctuation token">.</SPAN>geometries<SPAN class="punctuation token">.</SPAN>y<SPAN class="punctuation token">;</SPAN>
<SPAN class="punctuation token">}</SPAN>
<SPAN class="punctuation token">}</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>I am not sure I am using the parse correctly, but looking at examples in various places online I'm not sure how else it should be done. When I try to run the code the only result I get is "undefined."
What am I missing?