30 lines
708 B
JavaScript
30 lines
708 B
JavaScript
import {PLGNTLS_fetch} from '../../utils/plgntls_fetch.js';
|
|
|
|
const inputElement = document.getElementById('mytext');
|
|
const sendButton = document.getElementById('mybutton');
|
|
|
|
sendButton.addEventListener('click', () => {
|
|
let inputValue = inputElement.value;
|
|
inputValue = {
|
|
key1: 'value1',
|
|
key2: 'value2'
|
|
};
|
|
inputValue = JSON.stringify(inputValue);
|
|
console.log("inputValue:");
|
|
console.log(inputValue);
|
|
PLGNTLS_fetch('/plgntls/get_data', {
|
|
method: "POST",
|
|
})
|
|
//PLGNTLS_fetch('get_data', {body: {inputValue}})
|
|
.then((response) => response.json())
|
|
.then((data) => {
|
|
console.log("dataaa: ");
|
|
console.log(data);
|
|
})
|
|
.catch((error) => {
|
|
console.log("error: ");
|
|
console.log(error);
|
|
});
|
|
});
|
|
|