improved plugin class by changing for only one method to do all

This commit is contained in:
asus
2024-02-15 00:40:07 +01:00
parent 8d0122f63e
commit aaca16525b
7 changed files with 84 additions and 78 deletions

View File

@@ -1,6 +1,8 @@
console.log("PLGNTLS_data:");
console.log(PLGNTLS_data);
const title = document.querySelector(".first_el_to_change");
title.innerHTML = "--- coucou ;) " + myvar_1;
title.innerHTML = "--- coucou ;) " + PLGNTLS_data.myvar_1;
const ajax_button_1 = document.querySelector("#test_ajax_1");
ajax_button_1.addEventListener('click', () => {

View File

@@ -1,3 +1,3 @@
const title3 = document.querySelector(".third_el_to_change");
title3.innerHTML = "--- bye bye, " + myvar_2;
title3.innerHTML = "--- bye bye, " + PLGNTLS_data.myvar_2;

View File

@@ -5,5 +5,14 @@ sendButton.addEventListener('click', () => {
const inputValue = inputElement.value;
console.log("inputValue:");
console.log(inputValue);
ajax_post(inputValue, 'get_data');
PLGNTLS_ajax(inputValue, 'get_data')
.then((response) => response.json())
.then((data) => {
console.log("dataaa: ");
console.log(data);
})
.catch((error) => {
console.log("error: ");
console.log(error);
});
});