2024-04-16 17:13:42 +03:00
|
|
|
function ajaxRequest() {
|
|
|
|
const request = new XMLHttpRequest();
|
|
|
|
request.open("POST", "handler");
|
|
|
|
request.addEventListener("load", () => {
|
|
|
|
const responseText = request.responseText;
|
|
|
|
const targetElement = document.getElementById("buttonAdd");
|
2024-04-16 17:54:37 +03:00
|
|
|
const divElement = document.createElement("div");
|
|
|
|
divElement.classList.add("form-control");
|
|
|
|
divElement.style.backgroundColor = "#bbbbbb"; // Задайте здесь свой нужный стиль
|
|
|
|
divElement.innerHTML = responseText;
|
|
|
|
targetElement.insertAdjacentElement("beforebegin", divElement);
|
2024-04-16 17:13:42 +03:00
|
|
|
|
|
|
|
});
|
|
|
|
request.send();
|
|
|
|
}
|