📜  表单反应 js - Javascript 代码示例

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

代码示例3
function handleSubmit(e) {
        e.preventDefault();
        let formData = new FormData(e.target);
        fetch('http://192.168.1.192:3000/api/contribuable/nouveau', {
            method: 'POST',
            body: new URLSearchParams(formData)
        }).then(res => res.json())
            .then(response => {
                console.log(response)
            }).catch(console.log);
    }