I'm using the following code (v 4.6) to geocode an address:
Nisar,
When I added you lines of code above to one of the 4.x API sample it worked fine for me.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no">
<title>Intro to MapView - Create a 2D map - 4.6</title>
<style>
html,
body,
#viewDiv {
padding: 0;
margin: 0;
height: 100%;
width: 100%;
}
</style>
<link rel="stylesheet" href="https://js.arcgis.com/4.6/esri/css/main.css">
<script src="https://js.arcgis.com/4.6/"></script>
<script>
require([
"esri/Map",
"esri/views/MapView",
"esri/tasks/Locator",
"dojo/domReady!"
], function(Map, MapView, Locator) {
var map = new Map({
basemap: "streets"
});
var view = new MapView({
container: "viewDiv",
map: map,
zoom: 4,
center: [15, 65] // longitude, latitude
});
var locatorTask = new Locator({
url: "https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer"
});
var addressParams = {
"singleLine": "915 I St, Sacramento, CA"
};
locatorTask.addressToLocations({address:addressParams}).then(function(response){
console.log(response);
});
});
</script>
</head>
<body>
<div id="viewDiv"></div>
</body>
</html>
It returned this
That's odd. Perhaps I have accidentally turned off/on some feature in Firefox settings that is messing with the console output. I checked the same thing in Chrome console and it was showing the data as expected.
Not sure how I messed up Firefox though.
Nisar,
The way that FF console report the object is different but the data is still there:
Don't forget to mark this question as answered by clicking on the "Mark Correct" link on the reply that answered your question.