sašo-k
8/9/2017 - 10:19 AM

Java & Jquery

Java & Jquery

/* == Delete Item == */
$('body').on('click', 'a.delete', function () {
    var id = $(this).data('id');
    var name = $(this).data('name');
    var title = $(this).data('title');
    var option = $(this).data('option');
var extra = $(this).data('extra');
    var parent = $(this).parent().parent();
    new Messi("<p class=\"messi-warning\"><i class=\"massive icon warning sign push-left\"></i>" + config.lang.delMsg1  + "<br><strong>" + config.lang.delMsg2  + "</strong></p>", {
        title: title,
        titleClass: '',
        modal: true,
        closeButton: true,
        buttons: [{
            id: 0,
            label: 'Delete',
            class: 'red',
            val: 'Y'
        }],
        callback: function (val) {
            $.ajax({
                type: 'post',
                url: posturl,
                dataType: 'json',
                data: {
                    id: id,
                    delete: option,
		extra: extra ? extra : null,
                    title: encodeURIComponent(name)
                },
                beforeSend: function () {
                    parent.animate({
                        'backgroundColor': '#FFBFBF'
                    }, 400);
                },
                success: function (json) {
                    parent.fadeOut(400, function () {
                        parent.remove();
                    });
                    $.sticky(decodeURIComponent(json.message), {
                        type: json.type,
                        title: json.title
                    });
                }

            });
        }
    });
});