Получить идентификатор кнопки, которая открывает диалог

У меня есть кнопка внутри каждой строки таблицы, сгенерированной внутри цикла. Кнопка имеет класс click_link. Идентификатор будет другим для каждой строки. При нажатии кнопки создается диалоговое окно jquery. Мне нужен идентификатор кнопки внутри click() кнопок диалога, т.е. событие нажатия кнопки "Изменить"

$("#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');
});

person Techy    schedule 15.09.2015    source источник
comment
stackoverflow.com/questions/14898765 /   -  person afrin216    schedule 15.09.2015


Ответы (1)


Задайте для свойства data() идентификатор диалогового окна.

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

Затем позвоните в $("#dialog_loader").data("id of the button which create dialog"), где это необходимо

person Techy    schedule 15.09.2015