<?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: Map parsing json file works on localhost but not on web server in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/map-parsing-json-file-works-on-localhost-but-not/m-p/60440#M5308</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ah-hah, you and I are on the same page!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 18 May 2016 20:43:27 GMT</pubDate>
    <dc:creator>ChrisSmith7</dc:creator>
    <dc:date>2016-05-18T20:43:27Z</dc:date>
    <item>
      <title>Map parsing json file works on localhost but not on web server</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/map-parsing-json-file-works-on-localhost-but-not/m-p/60434#M5302</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi guys,&lt;/P&gt;&lt;P&gt;I copied this exact map (&lt;A href="https://developers.arcgis.com/javascript/latest/sample-code/layers-featurelayer-collection/live/index.html" title="https://developers.arcgis.com/javascript/latest/sample-code/layers-featurelayer-collection/live/index.html"&gt;Create a FeatureLayer with client side graphics - 4.0&lt;/A&gt; ) to my website and while it works on my localhost machine, it fails on the web server. On the server, the map loads, but none of the earthquake data is showing. The error I see in console is:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Test.htm:337 Creating legend failed.&amp;nbsp; SyntaxError: Unexpected token &amp;lt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; at Object.parse (native)&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; at c.json (&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=https%3A%2F%2Fjs.arcgis.com%2F4.0%2Finit.js%3A192%3A467" rel="nofollow" target="_blank"&gt;https://js.arcgis.com/4.0/init.js:192:467&lt;/A&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; at g (&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=https%3A%2F%2Fjs.arcgis.com%2F4.0%2Finit.js%3A191%3A119" rel="nofollow" target="_blank"&gt;https://js.arcgis.com/4.0/init.js:191:119&lt;/A&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; at k [as handleResponse] (&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=https%3A%2F%2Fjs.arcgis.com%2F4.0%2Finit.js%3A184%3A135" rel="nofollow" target="_blank"&gt;https://js.arcgis.com/4.0/init.js:184:135&lt;/A&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; at XMLHttpRequest.p (&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=https%3A%2F%2Fjs.arcgis.com%2F4.0%2Finit.js%3A188%3A240%29errback" rel="nofollow" target="_blank"&gt;https://js.arcgis.com/4.0/init.js:188:240)errback&lt;/A&gt;&lt;SPAN&gt; @ Test.htm:337f @ init.js:150p @ init.js:149reject.errback @ init.js:151f @ init.js:150p @ init.js:149reject.errback @ init.js:151f @ init.js:150p @ init.js:149reject.errback @ init.js:151f @ init.js:150p @ init.js:149reject.errback @ init.js:151(anonymous function) @ init.js:327e @ init.js:153f @ init.js:153l.reject @ init.js:156c @ init.js:154e @ init.js:154f @ init.js:153l.reject @ init.js:156c @ init.js:154e @ init.js:154f @ init.js:153l.reject @ init.js:156c @ init.js:154e @ init.js:154f @ init.js:153l.reject @ init.js:156c @ init.js:154e @ init.js:154f @ init.js:153l.reject @ init.js:156k @ init.js:184p @ init.js:188&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I don't have any clue on how to debug this. Any help is appreciated, thanks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm also attaching a screenshot of the "suspected" area when I click on the last line of the error console.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edit: This example is run on a asp.net environment. I put the same test map on a PHP server and it works. Does this have something to do with file permissions?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 May 2016 19:46:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/map-parsing-json-file-works-on-localhost-but-not/m-p/60434#M5302</guid>
      <dc:creator>DamNguyen</dc:creator>
      <dc:date>2016-05-18T19:46:58Z</dc:date>
    </item>
    <item>
      <title>Re: Map parsing json file works on localhost but not on web server</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/map-parsing-json-file-works-on-localhost-but-not/m-p/60435#M5303</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can debug back through the call stack sometimes in the API to see if anything clues you in. It's pretty clear at least it's finding an unexpected token "&amp;lt;" and croaking.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When you say you copied the example "exactly", did you really copy and paste the example verbatim and it worked, without any changes on your local copy?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The reason I ask... the &lt;EM&gt;getData() &lt;/EM&gt;func:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; function getData() {

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var url = "data/week.geojson";


&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return esriRequest(url, {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; responseType: "json"
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; });
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;...uses a relative path. The data is sourced here:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/javascript/latest/sample-code/layers-featurelayer-collection/live/data/week.geojson" title="https://developers.arcgis.com/javascript/latest/sample-code/layers-featurelayer-collection/live/data/week.geojson" rel="nofollow noopener noreferrer" target="_blank"&gt;https://developers.arcgis.com/javascript/latest/sample-code/layers-featurelayer-collection/live/data/week.geojson&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Make sure you copy the file locally and reference it in the relative way it is expecting (on your own site), or change the URL to the absolute path above. If you did copy the example exactly and made no changes, it may have worked perhaps because the file was cached? Just a thought... and a shot in the dark.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 22:18:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/map-parsing-json-file-works-on-localhost-but-not/m-p/60435#M5303</guid>
      <dc:creator>ChrisSmith7</dc:creator>
      <dc:date>2021-12-10T22:18:18Z</dc:date>
    </item>
    <item>
      <title>Re: Map parsing json file works on localhost but not on web server</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/map-parsing-json-file-works-on-localhost-but-not/m-p/60436#M5304</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ah, sorry. I did copy the json file to my local drive and placed it in a folder called data. So that relative path does point to an existing file. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried using the absolute path, and I got that cross domain error requiring some kind of proxy setup.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Test.htm:337 Creating legend failed.&amp;nbsp; Error: esri/config: esriConfig.request.proxyUrl is not set. If making a request to a CORS-enabled server, please push the domain into esriConfig.request.corsEnabledServers.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; at Error (native)&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; at Object.e.getProxyUrl (&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=https%3A%2F%2Fjs.arcgis.com%2F4.0%2Finit.js%3A346%3A266" rel="nofollow" target="_blank"&gt;https://js.arcgis.com/4.0/init.js:346:266&lt;/A&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; at l (&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=https%3A%2F%2Fjs.arcgis.com%2F4.0%2Finit.js%3A319%3A267" rel="nofollow" target="_blank"&gt;https://js.arcgis.com/4.0/init.js:319:267&lt;/A&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; at u (&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=https%3A%2F%2Fjs.arcgis.com%2F4.0%2Finit.js%3A324%3A417" rel="nofollow" target="_blank"&gt;https://js.arcgis.com/4.0/init.js:324:417&lt;/A&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; at y (&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=https%3A%2F%2Fjs.arcgis.com%2F4.0%2Finit.js%3A330%3A158" rel="nofollow" target="_blank"&gt;https://js.arcgis.com/4.0/init.js:330:158&lt;/A&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; at &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=https%3A%2F%2Fjs.arcgis.com%2F4.0%2Finit.js%3A331%3A181" rel="nofollow" target="_blank"&gt;https://js.arcgis.com/4.0/init.js:331:181&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; at e (&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=https%3A%2F%2Fjs.arcgis.com%2F4.0%2Finit.js%3A153%3A423" rel="nofollow" target="_blank"&gt;https://js.arcgis.com/4.0/init.js:153:423&lt;/A&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; at then.c.then (&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=https%3A%2F%2Fjs.arcgis.com%2F4.0%2Finit.js%3A156%3A232" rel="nofollow" target="_blank"&gt;https://js.arcgis.com/4.0/init.js:156:232&lt;/A&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; at a.extend.always (&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=https%3A%2F%2Fjs.arcgis.com%2F4.0%2Finit.js%3A158%3A512" rel="nofollow" target="_blank"&gt;https://js.arcgis.com/4.0/init.js:158:512&lt;/A&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; at C (&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=https%3A%2F%2Fjs.arcgis.com%2F4.0%2Finit.js%3A331%3A163" rel="nofollow" target="_blank"&gt;https://js.arcgis.com/4.0/init.js:331:163&lt;/A&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 May 2016 20:40:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/map-parsing-json-file-works-on-localhost-but-not/m-p/60436#M5304</guid>
      <dc:creator>DamNguyen</dc:creator>
      <dc:date>2016-05-18T20:40:54Z</dc:date>
    </item>
    <item>
      <title>Re: Map parsing json file works on localhost but not on web server</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/map-parsing-json-file-works-on-localhost-but-not/m-p/60437#M5305</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I see you made an edit that it's working in a PHP environment, but not an ASP.NET environment... You may want to try adding a MIME type for geojson in IIS. Can you access the geojson directly in the web browser?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 May 2016 20:41:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/map-parsing-json-file-works-on-localhost-but-not/m-p/60437#M5305</guid>
      <dc:creator>ChrisSmith7</dc:creator>
      <dc:date>2016-05-18T20:41:47Z</dc:date>
    </item>
    <item>
      <title>Re: Map parsing json file works on localhost but not on web server</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/map-parsing-json-file-works-on-localhost-but-not/m-p/60438#M5306</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The first thing I would do is open up the network tab in the debugging window and reload the page. Look for the request to the week.geojson file and examine the response.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Since the error message mentions the '&amp;lt;' character, I suspect that you are getting an error page instead of the JSON text, and the '&amp;lt;' is the beginning of an HTML response.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It's possible you may need to add the 'application/json' mime type to your server configuration before it will serve out JSON files. (The method for doing so will depend on what web server you are using.)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 May 2016 20:42:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/map-parsing-json-file-works-on-localhost-but-not/m-p/60438#M5306</guid>
      <dc:creator>JeffJacobson</dc:creator>
      <dc:date>2016-05-18T20:42:23Z</dc:date>
    </item>
    <item>
      <title>Re: Map parsing json file works on localhost but not on web server</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/map-parsing-json-file-works-on-localhost-but-not/m-p/60439#M5307</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I just noticed a bunch of other replies were added between when I started typing and when I submitted my reply. Oops.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 May 2016 20:43:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/map-parsing-json-file-works-on-localhost-but-not/m-p/60439#M5307</guid>
      <dc:creator>JeffJacobson</dc:creator>
      <dc:date>2016-05-18T20:43:25Z</dc:date>
    </item>
    <item>
      <title>Re: Map parsing json file works on localhost but not on web server</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/map-parsing-json-file-works-on-localhost-but-not/m-p/60440#M5308</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ah-hah, you and I are on the same page!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 May 2016 20:43:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/map-parsing-json-file-works-on-localhost-but-not/m-p/60440#M5308</guid>
      <dc:creator>ChrisSmith7</dc:creator>
      <dc:date>2016-05-18T20:43:27Z</dc:date>
    </item>
    <item>
      <title>Re: Map parsing json file works on localhost but not on web server</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/map-parsing-json-file-works-on-localhost-but-not/m-p/60441#M5309</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yay! It IS that missing json mime type! I added it and the map works well now. Thank you so much!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 May 2016 20:58:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/map-parsing-json-file-works-on-localhost-but-not/m-p/60441#M5309</guid>
      <dc:creator>DamNguyen</dc:creator>
      <dc:date>2016-05-18T20:58:54Z</dc:date>
    </item>
  </channel>
</rss>

