Hello! Very excited for V8! Amazing job as always.
But now I’m struggling on how to migrate my code, especially from request to fetch.
Does anyone have a good example on how to do it?
Thanks!
Hello! Very excited for V8! Amazing job as always.
But now I’m struggling on how to migrate my code, especially from request to fetch.
Does anyone have a good example on how to do it?
Thanks!
Hi,
i’m using PHP in my backend and was wondering why there the $_POST Data appeared to be empty and this gave me the solution:
There were two Options:
Either send the Request as Form Data
var formData = new FormData();
for(var item in data) {
formData.append(item, data[item]);
}
Or change the Backend to get the body from the fetch as a JSON
$_POST = json_decode(file_get_contents('php://input'), true);
And the Request would look like this
var response = await fetch(url, {
method: "POST",
body: JSON.stringify(data)
});
return response.json();