improved plugin class by changing for only one method to do all
This commit is contained in:
@@ -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', () => {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user