const url = 'https://MY_FUNCTION_ID.appwrite.global/';
const data = {
key1: 'value1',
key2: 'value2'
};
fetch(url, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(data)
})
.then(response => response.json())
.then(data => console.log('Success:', data))
.catch(error => console.error('Error:', error));
When i execute this code... I get some data from my server side (Appwrite cloud function).. unfortunately when I run this code through my website it won't get any data instead I got errors. It's working fine on browser console but not working when I run this on my website or when I'm on my website I still tried to run in console and it didn't worked as well. It only works in console of different sites... Can anyone fix it ? Or it's my Appwrite problem?