ArcGIS API for JavaScript: MyQueryLayers (MapServer)

Built using the ArcGIS API for JavaScript