Querying a Layer using an ArcGIS Online Map

ArcGIS-OnlineWhile exploring the possibilities of ArcGIS API for JavaScript, I was wondering how to query a web map that has been created through ArcGIS Online.

I spent quite a lot of time trying to figure out how to pass my Web Map created through ArcGIS Online as a URL. Especially for “var MapServiceToDisplay” and “var MapServiceToSearch”.

So here is the answer: