How to get a list of Services published on arcgis server for Add Layer functionality?

Discussion created by gauri_d on May 19, 2014
Latest reply on May 19, 2014 by gauri_d
I am working with web application using java-script api. I want to build  "add layer"  functionality.
How do I get a list of services published on server and add service to my application and also
remove service form TOC.
How do I use services directory in my code.

Please provide me at least some reference or any example.