I create new project using Framework7+cordova. I need to POST data to my Lumen Project. It’s always error like this:
my code on component Framework7 is like this:
var taskID = $$(this).data(‘task’);
var task = {
“task”: taskID
};
let fetchRes = fetch(“http://192.168.1.157:8000/do-task”,{
method: ‘POST’,
body: JSON.stringify(task)
});
fetchRes.then(response => {
if (!response.ok) {
throw new Error(‘Network error’);
}
return response.json();
})
.then(data => {
console.log(“success”);
})
.catch(error => {
if (error instanceof TypeError && error.message.includes(‘API key’)) {
console.error(‘Invalid API key:’, error);
} else {
console.error(‘There was a problem with the Fetch operation:’, error);
}
});
But i can getting data from my Lumen Project using fetch().
Please help, i was trying any instruction that provided on Google, but still failed.