jparfitt

ClosestFacilityTask Not Working

Discussion created by jparfitt on May 8, 2013
Latest reply on May 22, 2013 by jparfitt
I'm new to this but my ClosestFacilityTask isn't working. I can't find a working example online so I'm not sure what I'm doing wrong. I don't get an error but it isn't firing off in Fiddler either. Any help?


Thanks in Advance.


    dojo.connect(gsvc, "onBufferComplete", function (geometries) {
    
        var facilities = new esri.tasks.FeatureSet();
        facilities.features = [new esri.Graphic(geometries[0])]; ;

        var params = new esri.tasks.ClosestFacilityParameters();
        params.facilities = facilities;
        params.outSpatialReference = map.spatialReference;

        var closestFacilityTask = new esri.tasks.ClosestFacilityTask("http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Network/USA/NAServer/Closest Facility")
        closestFacilityTask.solve(params, function (solveResult) {
            alert('success');
        });
    });

Outcomes