pop onSelectionChange() not calling?

Discussion created by cleung on Aug 7, 2012

I am trying to use the the popup to display data from identify results.  For each of the identified features, I need to make a ajax call to fetch data from a webservice in order to populate the content of the popup.  I figured the best way to do it is to create a function, which will be called by the popup.onSelectionChange event.  Below is my code:

//step 1: create popup
var popup= new esri.dijit.Popup(null,dojo.create("div")); = new esri.Map(mapId,{extent: this.basemap.initialExtent,  infoWindow:popup});

//step 2: identify on mouse click

_handleMapClick: function(evt) {
    identifyParams.geometry = evt.mapPoint; 
    var deferred = identifyTask.execute(identifyParams);

      deferred.addCallback(function(response) {    
          // response is an array of identify result objects   
          // Let's return an array of features.
            return, function(result) {
            var feature = result.feature;
            var template = new esri.InfoTemplate();
            var record = feature.attributes;
            var name = record.NAME;
            template.setContent("<b>"+name+"</b><hr />");
            return feature;

    //step 3: show info window with results[ deferred ]);,;

//step 4: create listener
    var graphic = popup.getSelectedFeature();

the problem is the onSelectionChange function is never called as I am not able to see any console log.  Is there something wrong with my code/ syntax?