Answer the question
In order to leave comments, you need to log in
How to correctly pass using fetch method POST?
Below is an example of my code. I cut it down to the point so as not to load it.
let formData = new FormData();
formData.set('titlePost', 'Какой-то title');
formData.set('content', 'Какой-то content');
let promise = fetch('../ajax/sendpost.php', {
method: 'POST',
body: formData,
});
promise.then(
response => {
return response.text();
}
).then(
text => {
console.log(text);
}
);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question