AnsweredAssumed Answered

RouteTask returning server error

Question asked by jursachr_washco on Oct 29, 2015
Latest reply on Nov 2, 2015 by jursachr_washco

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("http://tasks.arcgisonline.com/ArcGIS/rest/services/NetworkAnalysis/ESRI_Route_NA/NAServer/Route");       
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? 

Outcomes