Hi Friends,
 
         I am using the  select2 controller binding the data on page load is working fine but when I click on the particular record the data not bind the properly on select2 controller.code is below.please guide thanks  
 
 
- function openMembershipPlanOfferModal(id) {    
-     
-     var url = '/MembershipPlanOffer/Upsert/';    
-     if (id != undefined) {    
-         url = url + id;    
-     }    
-     $('#membershipPlanId').select2({    
-         ajax: {    
-             contentType: 'application/json; charset=utf-8',    
-             dataType: 'json',    
-             type: 'GET',    
-             url: url,    
-             success: function (response) {    
-                     
-                 console.log(response);    
-                 var membershipPlans = [];    
-                 response.data.forEach(function (value, key) {    
-                     membershipPlans.push({ id: value.id, text: value.name })    
-                 });    
-             }    
-         }    
-     });    
-     $.get(url, function (data) {    
-         $("#membershipPlanOfferModal").html(data);    
-         $("#membershipPlanOfferModal").modal('show');    
-     });    
-       
- };