Hello,
I am attempting to solve a RouteTask but I am receiving an error, which I cannot solve.
//create new feature set
var myFeatures = [];
myFeatures.push(myAddressEventFeature);
myFeatures.push(myQueryResultsEvent.featureSet.features[0]);
//prepare parameters
var myRouteParams = new RouteParameters();
myRouteParams.stops = myFeatures;
myRouteParams.returnRoutes = true;
myRouteParams.returnDirections = true;
myRouteParams.outSpatialReference = new SpatialReference({ wkid:4326 });
//perform route between addresses
var myRouteTask = new RouteTask("url_goes_here");
myRouteTask.solve(myRouteParams);
//begin route task event handler
myRouteTask.on("solve-complete", function(myRouteTaskEvent)
{
//get route result
var myRouteResult = myRouteTaskEvent.routeResults;
myMap.graphics.add(myRouteResult.route);
}); //end route task event handler
I am getting the following errors.
SEC7120: Origin http://www.myserver.com not found in Access-Control-Allow-Origin header.
SCRIPT7002: XMLHttpRequest: Network Error 0x80070005, Access is denied.
According to https://community.esri.com/thread/53724#post208466, I can ignore the first error. However, I don't know about the second.
I am not receiving a result and the "solve complete " event is not being fired.
What am I doing wrong?
Hi Chris,
Both of the errors look like the cross domain issue, even the second error should be originating from the cors error. so i will suggest to set up a proxy for the NA service.
Using the proxy | Guide | ArcGIS API for JavaScript
Chen
I am using ArcGIS online and not ArcGIS Server. Does that matter?