常見post數(shù)據(jù)格式
FormData對象的使用
FileReader對象的使用
Form表單對象的使用
Form官方文檔
表單提交:事件和方法提交
Form表單&FileReader:文件的上傳和讀取
input type = ‘file’
HTMLElement官方文檔
input type = 'file'相關(guān)屬性官方文檔介紹
submit方法的使用
使用web應(yīng)用中的文件
Using files from web applications
Using XMLHttp?Request
AJax入門官方文檔
用XMLHttpRequest 發(fā)送表單信息、上傳文件
Ajax請求($.ajax()為例)中data屬性傳參數(shù)的形式
Array數(shù)組相關(guān)的使用
A brief introduction to the submit methods
An html <form> can be sent in four ways:
- using the
POSTmethod and setting theenctypeattribute toapplication/x-www-form-urlencoded(default); - using the
POSTmethod and setting theenctypeattribute totext/plain; - using the
POSTmethod and setting theenctypeattribute tomultipart/form-data; - using the
GETmethod (in this case theenctypeattribute 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.