AnsweredAssumed Answered

Update Map Service URL?

Question asked by cleotokos on Feb 26, 2016
Latest reply on Feb 29, 2016 by cleotokos

I have a map service ie.


var layerAgreementsOnly = new ArcGISDynamicMapServiceLayer("Census (MapServer) ");

What if I want to change the url? So if I get a security error when loading the map, I would like to switch out the existing url for another one that the user has permission to view. But I'm not sure the syntax or if this is possible.

 

        layerAgreementsOnly.on("error", function(result){
            var errCode = result.error.code.toString();
            //Test if a 403 security error has been received
            if (errCode.indexOf("403" > -1)){
                
              // code to update url here?

            }
            

               console.log("Error " + errCode + ": " + result.error.message);
        });

Outcomes