📜  formdata 追加反应 js - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:03:30.927000             🧑  作者: Mango

代码示例1
let formData = new FormData();    //formdata object

formData.append('name', 'ABC');   //append the values with key, value pair
formData.append('age', 20);

const config = {     
    headers: { 'content-type': 'multipart/form-data' }
}

axios.post(url, formData, config)
    .then(response => {
        console.log(response);
    })
    .catch(error => {
        console.log(error);
    });