2024-04-16 17:13:42 +03:00
|
|
|
function ajaxRequest() {
|
|
|
|
const request = new XMLHttpRequest();
|
2024-04-17 17:30:00 +03:00
|
|
|
request.open("GET", "/admin/form-add-fields");
|
2024-04-16 17:13:42 +03:00
|
|
|
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();
|
2024-04-17 17:30:00 +03:00
|
|
|
}
|
|
|
|
function getValueSelect(){
|
|
|
|
var selectValue = document.getElementById("selectID").value
|
|
|
|
var inputTags = document.getElementsByTagName('input');
|
|
|
|
var inputCount = inputTags.length - 3;
|
|
|
|
var request = new XMLHttpRequest()
|
|
|
|
request.open("GET", "/admin/set-value-select?value=" + selectValue + "&count=" + inputCount, true)
|
|
|
|
request.addEventListener("load", () => {
|
|
|
|
var responseText = request.responseText;
|
|
|
|
var targetElement = document.getElementById("buttonAdd");
|
|
|
|
var divElement = document.createElement("div");
|
|
|
|
divElement.classList.add("form-control");
|
|
|
|
divElement.style.backgroundColor = "#bbbbbb"; // Задайте здесь свой нужный стиль
|
|
|
|
divElement.innerHTML = responseText;
|
|
|
|
targetElement.insertAdjacentElement("beforebegin", divElement);
|
|
|
|
|
|
|
|
});
|
|
|
|
request.send()
|
|
|
|
}
|