18 lines
524 B
JavaScript
18 lines
524 B
JavaScript
// your_script.js
|
|
|
|
export function executeOperation(operationChoice) {
|
|
fetch(`/path/to/your_script.py?operation=${operationChoice}`)
|
|
.then(response => {
|
|
if (!response.ok) {
|
|
throw new Error(`HTTP error! Status: ${response.status}`);
|
|
}
|
|
return response.text();
|
|
})
|
|
.then(data => {
|
|
alert(data); // You can handle the response data as needed
|
|
})
|
|
.catch(error => {
|
|
console.error('Error:', error);
|
|
});
|
|
}
|