I'm using Vue3 and axios to post a form using FormData, but it's empty, nothing is being passed.
{"formData":{}}
Here's what I am doing:
const formData= new FormData();
formData.set("name", name);
axios.post("postform", formData);
I also tried this:
formData.set("name", "John Doe");
axios.post("postform", formData);
and this:
formData.append("name", "John Doe");
axios.post("postform", formData);
But no success. There's no errors, it's just empty.
I retrieve them in PHP like this:
echo $request->input("name");
So my question is:
How do I post data using FormData?
print_r($_REQUEST)in php rather thanecho $request->input("name");and see what shows