$.ajax({
  url: "/base_data",
  type: 'get',
  dataType: 'json',
  async: false,
  success: function(response) {
    $(response).each(function(index, value) {
      popup = L.marker([value.latitude, value.longitude]).addTo(map);
      popup.on("click", function() {
        var con = getMembers(value.id);
        // alert("CLicked"+value.id);
        // console.log(con);
        this.bindPopup(con).openPopup();
      });
    });
  },
  error: function() {
  }
});
            Asked
            
        
        
            Active
            
        
            Viewed 42 times
        
    0
            
            
         
    
    
        guradio
        
- 15,524
- 4
- 36
- 57
 
    
    
        Nitish Raj
        
- 1
- 1
- 
                    add all relevant code to OP – guradio Apr 19 '17 at 09:20
- 
                    What do you mean by OP? – Nitish Raj Apr 19 '17 at 09:23
- 
                    [check this i think this is helpfull ](http://stackoverflow.com/questions/17715274/jquery-click-function-doesnt-work-after-ajax-call) – Gopi Chand Apr 19 '17 at 09:30
- 
                    Please add your question – Mazz Apr 19 '17 at 09:37
- 
                    If the popup is deleted when you close it, the event has no element to handle. If it is the case, you have to use event delegation... Or just hide the popup. – kosmos Apr 19 '17 at 09:47
- 
                    By the way, OP means _"Original Post"_ – kosmos Apr 19 '17 at 09:48