WebForm - Pop Up Window

Can we add a bootstrap card in webform? Is it any possible way to do that. For example if we had some api call if the response will take some time means i want to show the pop up window in webform. How to do ? I tried normal javascript code but not its working

var card = document.createElement(“div”);
card.className = “card”;

    // Create card body element
    var cardBody = document.createElement("div");
    cardBody.className = "card-body";
    cardBody.innerText =
      "Wait for response.";

    // Create button element
    var button = document.createElement("button");
    button.className = "btn btn-primary";
    button.innerText = "Continue";
    button.addEventListener("click", function () {
      // Redirect to the specified URL
      window.location.href = ``;
    });

    // Append button to card body
    cardBody.appendChild(button);

    // Append card body to card
    card.appendChild(cardBody);

    // Set the value of the "card_html" field with the HTML code for the card
    frappe.web_form.set_value("card_html", card.outerHTML);

Thankyou