How set ajax data to Bootbox dialog?

Newbie picture Newbie · Jan 22, 2014 · Viewed 13.4k times · Source

How can i set data from ajax to bootbox dialog? Or I need use jquery ui dialog, when need to set some data?

this code not working

bootbox.dialog({
        message: data,
        title: "Custom title",
        buttons: {
        success: {
                label: "Success!",
                className: "btn-success",
            },
        }
    });

Answer

user3246025 picture user3246025 · Jan 28, 2014
jQuery.ajax({
    type: 'POST',
    url: $(this).attr('href'),
    success: function(data) {
        bootbox.dialog({
            message: data,
            title: "Custom title",
            buttons: {
                success: {
                    label: "Success!",
                    className: "btn-success",
                },
            }
        });
    }
});