常见post数据格式
FormData对象的使用
FileReader对象的使用
Form表单对象的使用
Form官方文档
表单提交:事件和方法提交
Form表单&FileReader:文件的上传和读取
input type = ‘file’
HTMLElement官方文档
input type = 'file'相关属性官方文档介绍
submit方法的使用
使用web应用中的文件
Using files from web applications
Using XMLHttpRequest
AJax入门官方文档
用XMLHttpRequest 发送表单信息、上传文件
Ajax请求($.ajax()为例)中data属性传参数的形式
Array数组相关的使用
A brief introduction to the submit methods
An html <form>
can be sent in four ways:
- using the
POST
method and setting theenctype
attribute toapplication/x-www-form-urlencoded
(default); - using the
POST
method and setting theenctype
attribute totext/plain
; - using the
POST
method and setting theenctype
attribute tomultipart/form-data
; - using the
GET
method (in this case theenctype
attribute will be ignored).
Now, consider the submission of a form containing only two fields, named foo
and baz
. If you are using the POST
method the server will receive a string similar to one of the following three examples, depending on the encoding type you are using:
-
Method:
POST
; Encoding type:application/x-www-form-urlencoded
(default):Content-Type: application/x-www-form-urlencoded foo=bar&baz=The+first+line.%0D%0AThe+second+line.%0D%0A
-
Method:
POST
; Encoding type:text/plain
:Content-Type: text/plain foo=bar baz=The first line. The second line.
-
Method:
POST
; Encoding type:[multipart/form-data](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types#multipartform-data)
:Content-Type: multipart/form-data; boundary=---------------------------314911788813839 -----------------------------314911788813839 Content-Disposition: form-data; name="foo" bar -----------------------------314911788813839 Content-Disposition: form-data; name="baz" The first line. The second line. -----------------------------314911788813839--
However, if you are using the GET
method, a string like the following will be simply added to the URL:
?foo=bar&baz=The%20first%20line.%0AThe%20second%20line.