FormData
The FormData object lets you compile a set of key/value pairs to send using XMLHttpRequest. It is primarily intended for use in sending form data, but can be used independently from forms in order to transmit keyed data. The transmitted data is in the same format that the form's submit() method would use to send the data if the form's encoding type were set to multipart/form-data.
FormData는 객체가 아닌 XMLHttpRequest 전송을 위해 설계된 특수한 객체 형태이다. 따라서 일반
console.log()
로는 출력할 수 없다전송 전에 FormData값을 확인하려면
entires(), keys(), values()
등을 활용하면 된다const data=new FormData() data.append('k1','v1') data.append('k2','v2') for(const item of data.entries()){ console.log(item) }
👍 따봉