asp.net mvc - how to read response when clicked on button of bootstrap popup? -


i developing mvc application. using bootstrp css.

i want use alert/dialog confirmation on delete record. should ask ok/cancel , according button click next process carried out...

i have below code form forum, works fine didn't event if clicked on ok or cancel button

how read these click events below code ?

$('#deactivate').click(function () {       var href = $(this).attr('href');     if (!$('#dataconfirmmodal').length) {         $('body').append('<div id="dataconfirmmodal" class="modal" role="dialog" aria-labelledby="dataconfirmlabel" aria-hidden="true"><div class="modal-header"><button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button><h6 id="dataconfirmlabel">deactivation confirmation</h6></div><div class="modal-body"><h3>are sure deactive @model.name ?</h3> </div><div class="modal-footer"><button class="btn" data-dismiss="modal" aria-hidden="true">cancel</button><a class="btn btn-primary" id="dataconfirmok">ok</a></div></div>');     }      $('#dataconfirmmodal').find('.modal-body').text($(this).attr('data-confirm'));     $('#dataconfirmok').attr('href', href);     $('#dataconfirmmodal').modal({show:true});       $('#dataconfirmok').on('click', function(e)      {         alert('@model.id');         var url2 = "@html.raw(url.action("deactivateparty", "party", new { @id = "pono"}))";         alert(url2);         url2 = url2.replace("pono", '@model.id');          $.post(url2, function (data) {             if(data == true)             {                 var url = $("#redirectto").val();                 location.href = url ;              }     });      return false;     }); 

you have specify event handler ok button:

$('#dataconfirmok').on('click', function(e) {     // call delete action here }); 

Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

javascript - Clean way to programmatically use CSS transitions from JS? -

android - send complex objects as post php java -