2015-09-15 1 views
1

J'ai un bouton à l'intérieur de chaque ligne d'une table générée à l'intérieur d'une boucle. Le bouton a la classe click_link. L'identifiant sera différent pour chaque ligne. En cliquant sur le bouton, une boîte de dialogue jquery est created.I besoin de l'ID du bouton à l'intérieur click() des boutons de dialogue, à savoir cliquez sur le bouton Modifier cas deRécupère l'identifiant du bouton qui ouvre la boîte de dialogue

$("#dialog_loader").dialog({resizable: false, 
    height:"auto", 
    modal: true, 
    minWidth: 500, 
    autoOpen:false, 
    buttons: { 
    "Edit": function() { 
     $.ajax({ 
      url:url1, 
      type:'POST', 
      data:data1, 
      success:function(msg){ 
       if(msg) 
       { 
        //alert(msg); 
       //Here I need to get the id of the button which creates 
       the dialog.That is id of the button with class **click_link** 
       } 
      } 
     }); 
    }, 
    Cancel: function() { 
     $(this).dialog("close"); 
    } 
    } 
}); 

//click event of button 
$(document).on('click','.click_link',function(){ 
    $("#dialog_loader").css({'display':'show'}); 
    $('#dialog_loader').dialog('open'); 
}); 
+1

http://stackoverflow.com/questions/14898765/pass-a-variable-to-jquery-ui-dialog – afrin216

Répondre

0

Set data() propriété à l'ID de boîte de dialogue

$('#dialog_loader').data('dialog_opener',"id of the button which create dialog").dialog('open'); 

Ensuite, appelez le $("#dialog_loader").data("id of the button which create dialog") où il est nécessaire