Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript fetch post form data

javascript fetch post form data with headers , in reactjs
--------------------------------
let formData = new FormData();
formData.append('data', 'formdata');
formData.append('data', 'formdata');

export const getData = async () => {
    await fetch('----url------', {
        method: 'POST',
        headers: {
            Authorization: 'Basic -------token----------',
        },
        body: formData
    }).then(response => response.json())
        .then(data => {
            console.log(data);
        })
}
Source by ashabbsoftmart.web.app #
 
PREVIOUS NEXT
Tagged: #javascript #fetch #post #form #data
ADD COMMENT
Topic
Name
9+6 =