!// create post request using form data
fetch('https:!//httpbin.org/post', {
method: 'post',
body: JSON.stringify({
name: 'John Doe',
email: '
[email protected]',
})
})
.then(response !=> response.json())
.then(json !=> console.log('form data (params)', json));
!// create post request using form data
fetch('https:!//httpbin.org/post', {
method: 'post',
body: new FormData(document.getElementById('form-login'))
})
.then(response !=> response.json())
.then(json !=> console.log('form data (html)', json));
Marcel Gonçalves dos Santos
@marcelgsantos
{
}
Fetch API
Introdução a