Web technology reference for developers
Structure of content on the web
Code used to describe document style
General-purpose scripting language
Protocol for transmitting web resources
Interfaces for building web applications
Developing extensions for web browsers
Build web projects usable for all
Learn web development
Learn to structure web content with HTML
Learn to style content using CSS
Learn to run scripts in the browser
Learn to make the web accessible to all
A customized MDN experience
Get real-time assistance and support
All browser compatibility updates at a glance
Write, test and share your code
참고 : 이 기능은 Web Worker에서 사용할 수 있습니다.
FormData 인터페이스는 form 필드와 그 값을 나타내는 일련의 key/value 쌍을 쉽게 생성할 수 있는 방법을 제공합니다. 또한 XMLHttpRequest.send() 메서드를 사용하여 쉽게 전송할 수 있습니다. 인코딩 타입이 "multipart/form-data"로 설정된 경우, form에서 사용하는 것과 동일한 포맷을 사용해야 합니다.
FormData
XMLHttpRequest.send()
"multipart/form-data"
간단한 GET 전송을 사용하는 경우에는 <form> 이 수행하는 방식으로 쿼리 매개 변수를 생성할 수 있습니다. 이 경우 URLSearchParams 생성자에 직접 전달할 수 있습니다.
GET
<form>
URLSearchParams
FormData 를 구현하는 객체는 entries() 대신 for...of 구조를 직접 사용할 수 있습니다. for (var p of myFormData) 는 for (var p of myFormData.entries()) 와 같습니다.
entries()
for...of
for (var p of myFormData)
for (var p of myFormData.entries())
FormData()
새로운 FormData 객체를 생성합니다.
FormData.append()
FormData 객체안에 이미 키가 존재하면 그 키에 새로운 값을 추가하고, 키가 없으면 추가합니다.
FormData.delete()
FormData 객체로부터 키/밸류 쌍을 삭제합니다.
FormData.entries()
이 객체에 담긴 모든 키/밸류 쌍을 순회할 수 있는 iterator를 반환합니다.
iterator
FormData.get()
FormData 객체 내의 값들 중 주어진 키와 연관된 첫번째 값을 반환합니다.
FormData.getAll()
FormData 객체 내의 값들 중 주어진 키와 연관된 모든 값이 담긴 배열을 반환합니다.
FormData.has()
FormData 객체에 특정 키가 포함되어 있는지 여부를 나타내는 boolean 을 반환합니다.
FormData.keys()
이 객체에 담긴 모든 키/벨류 쌍들의 모든 키들을 순회 할 수 있는 iterator를 반환합니다.
FormData.set()
FormData 객체 내에 있는 기존 키에 새 값을 설정하거나, 존재하지 않을 경우 키/밸류 쌍을 추가합니다.
FormData.values()
이 객체에 포함된 모든 밸류를 통과하는 iterator를 반환합니다.
BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.
XMLHTTPRequest
<Form>