I want a submit type button to send a POST request.
I am thinking about something like this:
You can do that with a little help of JS. In the example below, a POST request is being submitted on a button click using the fetch method:
const button = document.getElementById('post-btn');
button.addEventListener('click', async _ => {
try {
const response = await fetch('yourUrl', {
method: 'post',
body: {
// Your body
}
});
console.log('Completed!', response);
} catch(err) {
console.error(`Error: ${err}`);
}
});