I am using bootbox for flexible dialogs and alerts asnd encountered a problem with following callback function:
var qty= 0;
bootbox.prompt({
title: "Insert qty!",
inputType: 'number',
callback: function (result) {
qty = result;
}
});
alert(qty);
My alert triggers before the bootbox dialog is opened. Why is the alert triggered before the bootbox dialog? How can I avoid getting 0 instead of a desired value in my bootbox-dialog?
How about this?
bootbox.prompt({
title: "Insert qty!",
inputType: 'number',
callback: function (result) {
qty = result;
}
}, function (qty) {
alert(qty);
})