<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: ESRI JavaScript API 3.8 Locator: SyntaxError {log: undefined, stack: (…), message: “Unexpected token &amp;lt;”} in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/esri-javascript-api-3-8-locator-syntaxerror-log/m-p/583727#M54531</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Also, it would help if you posted a code snippet so we can see how you setup/use the Geocoder widget.&amp;nbsp; Sometimes the token errors aren't related to security but have to do with some invalid parameter.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 10 Jul 2014 17:09:25 GMT</pubDate>
    <dc:creator>IanGrasshoff</dc:creator>
    <dc:date>2014-07-10T17:09:25Z</dc:date>
    <item>
      <title>ESRI JavaScript API 3.8 Locator: SyntaxError {log: undefined, stack: (…), message: “Unexpected token &lt;”}</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/esri-javascript-api-3-8-locator-syntaxerror-log/m-p/583725#M54529</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="margin: 0 0 1em; font-size: 14px; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; background-color: rgba(248, 248, 248, 0.6);"&gt;I am having issues trying to set up a geocoder/locator on my server and also trying to query my geometry service when trying to project some lat/long coordinated. I keep getting an error &lt;STRONG&gt;SyntaxError {log: undefined, stack: (...), message: "Unexpected token &amp;lt;"}&lt;/STRONG&gt;, but I can't seem to figure out why. I tried exploring the error message, but I don't get much good information out of it.&lt;/P&gt;&lt;P style="margin: 0 0 1em; font-size: 14px; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; background-color: rgba(248, 248, 248, 0.6);"&gt;I have tried using ESRI's geocoder widget then created my own set up using the locator service. I have checked my address string, and I believe it should be passing correctly over to the server.&lt;/P&gt;&lt;P style="margin: 0 0 1em; font-size: 14px; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; background-color: rgba(248, 248, 248, 0.6);"&gt;If I am understanding the error message right, it is saying there is a token "&amp;lt;" somewhere that shouldn't be there, but I cannot find it.&lt;/P&gt;&lt;P style="margin: 0 0 1em; font-size: 14px; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; background-color: rgba(248, 248, 248, 0.6);"&gt;Other info... I am running version 9.3.1 for my server, using the JavaScript API 3.8 that ESRI hosts, and created an address locator on my server using street centerlines for the area I am mapping.&lt;/P&gt;&lt;P style="margin: 0 0 1em; font-size: 14px; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; background-color: rgba(248, 248, 248, 0.6);"&gt;Has anyone run into this issue before or have suggestions for me? Right now, I am just trying to center the map on the location. Once I get that done, I can worry about all the other stuff.&lt;/P&gt;&lt;P style="margin: 0 0 1em; font-size: 14px; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; background-color: rgba(248, 248, 248, 0.6);"&gt;My code for the locator is below.&amp;nbsp; The site I am working on is at: &lt;A href="https://www.cartotronics.com/UTC_Viewer_LouisvilleKY/" title="https://www.cartotronics.com/UTC_Viewer_LouisvilleKY/" rel="nofollow noopener noreferrer" target="_blank"&gt;Louisville Urban Tree Canopy Analysis&lt;/A&gt;‌.&amp;nbsp; &lt;/P&gt;&lt;P style="margin: 0 0 1em; font-size: 14px; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; background-color: rgba(248, 248, 248, 0.6);"&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt; /////////////////////////////////////////////////////////////////
locator = new Locator(singleFieldGeocodeURL);
//add handler for completion
locator.on("address-to-locations-complete", showResults);

//trying to find the error
locator.on("error", function (error) {
&amp;nbsp; errorObject = error;
&amp;nbsp; console.log("error" + error);

});


//add handler for button click
on(dom.byId('locate'), 'click', function () {

&amp;nbsp; console.log(dom.byId('address').value);

&amp;nbsp; map.graphics.clear();
&amp;nbsp; var address = {
&amp;nbsp; "SingleLine": dom.byId('address').value
&amp;nbsp; };

&amp;nbsp; locator.outSpatialReference = map.spatialReference;

&amp;nbsp; var options = {
&amp;nbsp; address: { street: address },
&amp;nbsp; outFields: ["Loc_name"]

&amp;nbsp; };
&amp;nbsp; locator.addressToLocations(options);

});

function showResults(evt) {
&amp;nbsp; console.log("in show results");
&amp;nbsp; var candidate;
&amp;nbsp; var symbol = new SimpleMarkerSymbol();
&amp;nbsp; symbol.setStyle(SimpleMarkerSymbol.STYLE_SQUARE);
&amp;nbsp; symbol.setColor(new Color([153, 0, 51, 0.75]));

&amp;nbsp; var geom;
&amp;nbsp; arrayUtils.event(evt.addresses, function (candidate) {
&amp;nbsp; console.log(candidate.score);
&amp;nbsp; if (candidate.score &amp;gt; 80) {
&amp;nbsp; console.log(candidate.location);
&amp;nbsp; var attributes = {
&amp;nbsp; address: candidate.address,
&amp;nbsp; score: candidate.score,
&amp;nbsp; locatorName: candidate.attributes.Loc_name
&amp;nbsp; };
&amp;nbsp; geom = candidate.location;
&amp;nbsp; var graphic = new Graphic(geom, symbol, attributes, null);
&amp;nbsp; map.graphics.add(graphic);

&amp;nbsp; return false;

&amp;nbsp; }
&amp;nbsp; });

&amp;nbsp; if (geom !== undefined) {
&amp;nbsp; map.centerAndZoom(geom, 12);
&amp;nbsp; }

}&lt;/CODE&gt;



&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 01:06:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/esri-javascript-api-3-8-locator-syntaxerror-log/m-p/583725#M54529</guid>
      <dc:creator>BrandonColeman</dc:creator>
      <dc:date>2021-12-12T01:06:11Z</dc:date>
    </item>
    <item>
      <title>Re: ESRI JavaScript API 3.8 Locator: SyntaxError {log: undefined, stack: (…), message: “Unexpected token &lt;”}</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/esri-javascript-api-3-8-locator-syntaxerror-log/m-p/583726#M54530</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That's the type of error you get when trying to access a secure service without logging in/providing a token via your code.&amp;nbsp; I would start by checking the security on your ArcGIS server rest service/folder.&amp;nbsp; If you have security switched on, then you will need to provide a token (you should use a proxy page).&amp;nbsp; If you don't need security just switch it off and try again.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Jul 2014 17:07:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/esri-javascript-api-3-8-locator-syntaxerror-log/m-p/583726#M54530</guid>
      <dc:creator>IanGrasshoff</dc:creator>
      <dc:date>2014-07-10T17:07:11Z</dc:date>
    </item>
    <item>
      <title>Re: ESRI JavaScript API 3.8 Locator: SyntaxError {log: undefined, stack: (…), message: “Unexpected token &lt;”}</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/esri-javascript-api-3-8-locator-syntaxerror-log/m-p/583727#M54531</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Also, it would help if you posted a code snippet so we can see how you setup/use the Geocoder widget.&amp;nbsp; Sometimes the token errors aren't related to security but have to do with some invalid parameter.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Jul 2014 17:09:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/esri-javascript-api-3-8-locator-syntaxerror-log/m-p/583727#M54531</guid>
      <dc:creator>IanGrasshoff</dc:creator>
      <dc:date>2014-07-10T17:09:25Z</dc:date>
    </item>
    <item>
      <title>Re: ESRI JavaScript API 3.8 Locator: SyntaxError {log: undefined, stack: (…), message: “Unexpected token &lt;”}</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/esri-javascript-api-3-8-locator-syntaxerror-log/m-p/583728#M54532</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here is the code I was using for the widget...&amp;nbsp; I added in a div id='search' to try this on.&amp;nbsp; I am not sure about the 3rd parameter of the myGeocoders list though.&amp;nbsp; The first time I tried it, I wasn't using a 3rd parameter.&amp;nbsp; I just tried it using the SingleField geocoder, and I got the same message.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;var myGeocoders = [{ url: singleFieldGeocodeURL, name: "SingleField", singleLineFieldName: "ROADNAME" }, { url: alphaNumericGeocodeURL, name: "AlphaNumeric" }];&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; geocoder = new Geocoder({&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; map: map,&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; autoComplete: true,&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcgisGeocoder: false,&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; geocoders: myGeocoders&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }, "search");&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;geocoder.startup();&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, for sharing the the ArcGIS Server/Rest folder... I didn't set up the server so I am not sure if it is set properly.&amp;nbsp; For the rest folder, do I have to grant the SOC and SOM user accounts read/write access to it?&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, I have tried using the geometry service I set up, and I got the same error message.&amp;nbsp; For that, I was trying to use HTML5's geolocation to position the map to the person's approximate location.&amp;nbsp; I was trying to use the geometry service to reproject the lat/long coords into my map's projection.&amp;nbsp; That code is:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;on(map, "load", function () {&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (navigator.geolocation) {&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; navigator.geolocation.getCurrentPosition(ZoomToPosition);&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; });&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; function ZoomToPosition(position) {&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var symbol = new SimpleMarkerSymbol();&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; symbol.setStyle(SimpleMarkerSymbol.STYLE_CIRCLE);&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; symbol.setColor(new Color([153, 0, 51, 0.75]));&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var input = new Point(position.coords.latitude, position.coords.longitude, new SpatialReference({wkid: 4326}));&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var PrjParams = new ProjectParameters();&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PrjParams.geometries = [input];&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PrjParams.outSR = new SpatialReference({ wkid: 2246 });&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; geometryService.project(PrjParams, function (outputPoint) {&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var graph = new Graphic(outputPoint, symbol);&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; map.graphics.add(graph);&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; map.centerAndZoom(graph, 12);&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; })&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks again for any advice!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Jul 2014 12:22:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/esri-javascript-api-3-8-locator-syntaxerror-log/m-p/583728#M54532</guid>
      <dc:creator>BrandonColeman</dc:creator>
      <dc:date>2014-07-11T12:22:46Z</dc:date>
    </item>
    <item>
      <title>Re: ESRI JavaScript API 3.8 Locator: SyntaxError {log: undefined, stack: (…), message: “Unexpected token &lt;”}</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/esri-javascript-api-3-8-locator-syntaxerror-log/m-p/583729#M54533</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I found out from someone on GIS Stack Exchange that my issue was something as simple as a wrong URL.&amp;nbsp; My URL wasn't point at the rest directory in my code.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That error is gone now.&amp;nbsp; Thanks to anyone who was trying to help me out on this!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 Jul 2014 12:17:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/esri-javascript-api-3-8-locator-syntaxerror-log/m-p/583729#M54533</guid>
      <dc:creator>BrandonColeman</dc:creator>
      <dc:date>2014-07-14T12:17:16Z</dc:date>
    </item>
  </channel>
</rss>

