now we can add attributes to js files using the tools class
This commit is contained in:
@@ -1,29 +1,4 @@
|
||||
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);
|
||||
});
|
||||
});
|
||||
import { test_fetch } from './example_submenu.js';
|
||||
|
||||
test_fetch();
|
||||
|
||||
29
plugins/fipfcard_plugin/js/menu/example_menu_2.js
Normal file
29
plugins/fipfcard_plugin/js/menu/example_menu_2.js
Normal file
@@ -0,0 +1,29 @@
|
||||
|
||||
const inputElement2 = document.getElementById('mytext_2');
|
||||
const sendButton2 = document.getElementById('mybutton_2');
|
||||
|
||||
sendButton2.addEventListener('click', () => {
|
||||
let inputValue = inputElement2.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);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
33
plugins/fipfcard_plugin/js/menu/example_submenu.js
Normal file
33
plugins/fipfcard_plugin/js/menu/example_submenu.js
Normal file
@@ -0,0 +1,33 @@
|
||||
|
||||
import { PLGNTLS_fetch } from '../../utils/plgntls_fetch.js';
|
||||
|
||||
export function test_fetch() {
|
||||
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);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user