Can you please take a look at This Demo and let me know how I can get the Selected Layer Name through API when check boxes are checked?

As you can see at This Link the service is providing 3 layers as:

enter image description here

and I need to get these names as they are selected I already tried the Request layer info but this seems retuns metadata about fields only.


As mentioned , you have to set an ajax request to service-url?f=json and loop the Layers tab json response to access each layer name , id ...

same thing to generate check boxes .

required js =>

"esri/request", ajax req

"dojo/dom-construct", creating dynamic checkbox

"dojo/_base/array", looping json Layers array

You can find a sample solution here : => Fiddle


if you're looking for metadata describing the layer names, the request you need to make is to the map service itself


each id and name can be found inside the layers array within the json response.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.