---
slug: "ajax-取得内容を-bootbox-dialog-で表示する"
title: "Displaying AJAX-Fetched Content in a Bootbox Dialog"
description: "Here is a code example demonstrating how to display content retrieved via AJAX in a dialog using Bootbox."
url: "https://www.ytyng.com/en/blog/ajax-取得内容を-bootbox-dialog-で表示する"
publish_date: "2017-08-01T10:40:47Z"
created: "2017-08-01T10:40:47Z"
updated: "2026-02-27T04:49:31.000Z"
categories: ["Bootstrap", "Javascript"]
keywords: ""
featured_image_url: "https://media.ytyng.com/resize/20230812/21005b0acfd744fbbd47ba4ef1e3c3f8.png.webp?width=768"
has_video: false
has_music: false
video_urls: []
music_urls: []
lang: "en"
---

# Displaying AJAX-Fetched Content in a Bootbox Dialog

<p>Here is an example code showing how to display the content retrieved via AJAX within a Bootbox dialog.</p>

<h1>Asynchronous (Recommended)</h1>
<pre>
        var bb = bootbox.dialog({
            message: 'Loading...',
            onEscape: true,
            backdrop: true
        });
        var bbBody = bb.find('.bootbox-body');
        $.ajax({
            url: &lt;URL&gt;,
            success: function (data) {
                bbBody.html(data);
            }
        });
</pre>

<h1>Render after waiting for the response (Feels slower)</h1>
<pre>
        $.ajax({
            url: &lt;URL&gt;,
            success: function (data) {
                bootbox.dialog({
                    message: data,
                    onEscape: true,
                    backdrop: true
                });
            }
        });
</pre>
