12 lines
359 B
JavaScript
12 lines
359 B
JavaScript
function ajaxRequest() {
|
|
const request = new XMLHttpRequest();
|
|
request.open("POST", "handler");
|
|
request.addEventListener("load", () => {
|
|
const responseText = request.responseText;
|
|
const targetElement = document.getElementById("buttonAdd");
|
|
|
|
targetElement.insertAdjacentHTML("beforebegin", responseText);
|
|
|
|
});
|
|
request.send();
|
|
} |