jQuery plugin that extend standard confirm dialog. Provide callback and can be also configured for each element through data attributes.
Place in html code following div element
<a href="#" class="confirm-action" data-url="/api/some-action.json">Some Action</a>
Initialize plugin with
$('.confirm-action').confirmAction({
'type': 'POST',
'message': 'Are you REALLY REALLY sure you want to do that?'
});
{
url: null,
message: 'Are you sure?',
type: 'GET'
}
url option is mandatory and is usually set as data-url attribute. Without it plugin won't innitialize for this element
$('.confirm-action').confirmAction(function(response){
// hide parent tr in table
$(this).parents('tr:first').fadeOut();
});
$('.confirm-action').confirmAction({
type: 'POST'
},function(response){
// hide parent tr in table
$(this).parents('tr:first').fadeOut();
});
Released under the MIT license.