I'm using angular 8. And I'm sending an Esri request to a specific Url.
Here's as snippet of my Code:
Here's the error I'm having when trying to view the response returned by the request:
After googling it, I found out that the response returned by the Esri Request is nothing but the HTML page of the Data I want, and not a Json of the Data.
Here's the response:
So what's the wrong thing I'm doing here ??
Solved! Go to Solution.
Update your request options to tell the service to send a json response.
{
query: {
f: "json"
},
responseType: "json"
}
If not, the server just assumes you want the regular HTML page. You can see how it works in this sample.
https://developers.arcgis.com/javascript/latest/sample-code/request/index.html
Update your request options to tell the service to send a json response.
{
query: {
f: "json"
},
responseType: "json"
}
If not, the server just assumes you want the regular HTML page. You can see how it works in this sample.
https://developers.arcgis.com/javascript/latest/sample-code/request/index.html
You get the html page because you are not asking for json. Add the "f" (format) value to the "query" options parameter:
esriRequest(url,{query:{f:"json"}}).then(...);