There are a few things to fix but the main one is how you're assigning callback functions for your query tasks. Since you're re-using global variables for your query tasks, each time showResults() is called, a new callback is attached to your query task. To avoid this, I'd recommend passing in a function for the callback argument of queryTask.execute() instead of using dojo.connect to add a new callback each time showResults() runs. Take a look at the attached code to see how this is done. The other big change I made was to use a new global to keep track of the current map click (variable named "currentClick"). I also took out your bClick variable as it seemed unnecessary (but maybe I'm missing something).
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.