post - request
by velo_ninja
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Get Data from Function</title>
</head>
<body>
<button onclick="getData()">Click to Get Data</button>
<script>
function getData() {
console.log('Making request...');
wixFetch('https://www.media-junkie.com/_functions/filter?database=Team', {
method: 'GET',
headers: {
'Content-Type': 'application/json',
},
})
.then(response => {
console.log('Response received:', response);
return response.json();
})
.then(data => {
console.log('Data from server:', data);
// Handle the data as needed
})
.catch(error => {
console.error('Error getting data:', error);
});
}
</script>
</body>
</html>