- forget old ajax wp, now use fetch wp
- trying js files without imports
This commit is contained in:
@@ -2,13 +2,16 @@ const inputElement = document.getElementById('mytext');
|
||||
const sendButton = document.getElementById('mybutton');
|
||||
|
||||
sendButton.addEventListener('click', () => {
|
||||
const inputValue = inputElement.value;
|
||||
let inputValue = inputElement.value;
|
||||
inputValue = {
|
||||
key1: 'value1',
|
||||
key2: 'value2'
|
||||
};
|
||||
inputValue = JSON.stringify(inputValue);
|
||||
console.log("inputValue:");
|
||||
console.log(inputValue);
|
||||
//PLGNTLS_ajax('get_data', inputValue)
|
||||
PLGNTLS_fetch('get_data', {
|
||||
body: {inputValue},
|
||||
})
|
||||
PLGNTLS_ajax('get_data', inputValue)
|
||||
//PLGNTLS_fetch('get_data', {body: {inputValue}})
|
||||
.then((response) => response.json())
|
||||
.then((data) => {
|
||||
console.log("dataaa: ");
|
||||
|
||||
Reference in New Issue
Block a user