now ajax is in PLGMTLS object as a method

This commit is contained in:
asus
2024-02-15 02:47:11 +01:00
parent aaca16525b
commit 6c893049dc
5 changed files with 76 additions and 59 deletions

View File

@@ -6,5 +6,15 @@ title.innerHTML = "--- coucou ;) " + PLGNTLS_data.myvar_1;
const ajax_button_1 = document.querySelector("#test_ajax_1");
ajax_button_1.addEventListener('click', () => {
ajax_post(ajax_button_1, 'get_data');
PLGNTLS_data.ajax(ajax_button_1, 'get_data')
.then((response) => response.json())
.then((data) => {
console.log("datou: ");
console.log(data);
})
.catch((error) => {
console.log("error: ");
console.log(error);
})
;
});