amerzafar
12/18/2017 - 5:26 AM

confirm js bootstrap confirmation.html

confirm js bootstrap confirmation.html



<span title="Delete" onclick="stopPropagation();">
    <i class="fa fa-trash" id="{$T.obj.ChapterId}" data-toggle="confirmation" data-copy-attributes="id"
       data-original-title="Are you sure you want to delete this chapter?"
       data-placement="left" data-on-confirm="btnDeleteChapter_Clicked" style="cursor:pointer;"></i>
</span>

<script type="javascript">

function initConfirm() {
    //// http://bootstrap-confirmation.js.org/

    if ($('[data-toggle="confirmation"]').length > 0) {
        $('[data-toggle="confirmation"]').confirmation({
            singleton: 'true',
            popout: 'true',
            btnCancelIcon: '',
            btnOkIcon: ''
        });
    }
}

function btnDeleteChapter_Clicked() {
    var chapterId = window.event.target.id;

    var url = "/template/DeleteChapter";

    showMessage("Chapter deleted successfully!", 'success');

    removeDom($('#rowChapter' + chapterId));

    var data = { "chapterId": chapterId };

    ajax(url, function (d) {
        if (d === true) {

        } else {
            showMessage("Error in deleting chapter", 'error');
        }
    }, data);

    return false;
}
</script>