makeusabrew/bootbox — Issue #16: Confirm modal before deleting a post
Author: ACAR27
Created: 2012-01-23 18:13:18+00:00
State: open

Hi,

I'm quite a noob in JS and I need your help to merge your confirmation function with my jQuery function (Ajax call for deleting some informations).

Here is my JS Code :

function DelFav(var1,var2) {
jQuery.ajax({
type: "GET",
url: "......url...with...params......",
error:function(msg){
alert( "Error !: " + msg );
},
success:function(data){
jQuery('#communication').empty();
jQuery('#communication').html(jQuery('#communication').text() + data + " ");
}});
}

This function is called by a link near each objects. Here is the HTML part :

a class="button icon remove danger" href="javascript:void(0);" onClick="javascript:DelFav(var1,var2);" style="text-decoration: none !important;">Delete /a>

When a user click on the delete link, i'd like a confirmation dialog to be shown with yes or no buttons. If YES button is clicked, the ajax call is sent.

Could you please tell me how to figure out?

Thank you!