useFetch and POST data #632
Unanswered
Babelfisch
asked this question in
Q&A
Replies: 1 comment 1 reply
-
Hi @Babelfisch When you send the post request const { data } = useFetch(url).post({ foo: "bar" }); what do you see on the network tab of the browser? This is correct, the docs should be updated. const { data } = useFetch(url).json().get() Even when const { data } = useFetch(url).json() |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am a little bit confused about how
useFetch
works. With this simple call I try to submit a POST request to a PHP script:But the PHP script doesn't receive the POST data and
$_POST['foo']
is not set.There is no example with data in the doc and I tried many variants without success. Any ideas how I can send POST data to a script?
Second question: In the doc and several discussion, the usage of
json()
or.text()
is like this:But this order does not work and produces this error:
Only this works by me:
Whats correct and why?
Beta Was this translation helpful? Give feedback.
All reactions