Displaying AJAX-Fetched Content in a Bootbox Dialog
BootstrapJavascript
2017-08-01 10:40 (9 years ago)

Here is an example code showing how to display the content retrieved via AJAX within a Bootbox dialog.
Asynchronous (Recommended)
var bb = bootbox.dialog({
message: 'Loading...',
onEscape: true,
backdrop: true
});
var bbBody = bb.find('.bootbox-body');
$.ajax({
url: <URL>,
success: function (data) {
bbBody.html(data);
}
});
Render after waiting for the response (Feels slower)
$.ajax({
url: <URL>,
success: function (data) {
bootbox.dialog({
message: data,
onEscape: true,
backdrop: true
});
}
});
Please rate this article (No signup or login required)
Currently unrated
Related posts
A TypeScript Decorator to Show a Toast When $axios.$get Fails in an Async Method with Nuxt
Differences in Behavior with and without Await in Functions that Create and Return Promises Inside JS Promises
Specifying Tooltip Position with JQuery ValidationEngine
Randomly Selecting the Initial Active Item in a Bootstrap Carousel
The author runs the application development company Cyberneura.
We look forward to discussing your development needs.
We look forward to discussing your development needs.