I have two map services which both services contains some layers.I want identifier for both services.How can i do it.
The IdentifyTask is what you are looking for then. Here is a sample on using the IdentifyTask (the sample one identifies one map service layer but can easily be modified to do more like you are wanting):
Here's an example of using multiple services in an IdentifyTask: https://community.esri.com/message/442805?commentID=442805#comment-382158
It's old and should be updated to modern syntax, but it give you an idea of how it's done.
Retrieving data ...