Files
goodgarden/index.js
mohammedcifci78 ef18410631 week3.2
2024-02-28 11:06:23 +01:00

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);
});
}