rwConfirm Plugin

Modal dialog confirmation and message based on bootstrap v3

Designed for ReadyWorks

1- Default Configuration:

$.rwConfirm.defaults = {
    title: 'Delete Item',
    message: 'Are you sure you want to delete the Item?',
    text: null,    
    labelConfirm: 'Delete',
    labelCancel: 'Cancel',
    btnWidth: 100, // min-width of the buttons by default 100px, values possible as well: auto
    size: 'medium', // small, medium, large, 
    animation: true,
    isAjax: false, // if isAjax == true then a spinner is used and the dialog is closed automatically when the ajax request is completed
    onConfirm: function() {},
    onCancel: function() {},
};

2- Demos:

  Basic call
$.rwConfirm({
    message: 'Are you sure you want to delete the Order?',
    onConfirm: function() {
        // do your action here
        alert('do your action here');
    }
});
  Delete an Item using ajax request
$.rwConfirm({
    title: 'Delete Computer',
    message: 'Are you sure you want to delete the Computer?',
    text: '<b>Computer Name:</b> AR006-L-TEST1',
    isAjax: true,
    onConfirm: function() {
        $.ajax({
            type: 'post',
            url: 'ajax/process.php?q=delete',
            data: {'param1': param1, 'param2': param2},
            dataType: 'JSON',
            beforeSend: function () {
            }
        })
        .done(function(response) {
            if(response.type === 'success') {
                alert('Computer deleted successfully');
            }
            else {
                alert('Something went wrong');
            }
        })
        .always(function() {
        });
    }
});
  Cutomize the dialog
$.rwConfirm({
    title: 'Custom Title',
    message: 'This is custom message?',
    size: 'small',
    labelConfirm: 'Yes',
    labelCancel: 'No',
    labelCancel: 'No',
    btnWidth: 'auto',
    onConfirm: function() {
        alert('You clicked on Yes');
    },
    onCancel: function() {
        alert('You clicked on No');
    }
});