JS下的網(wǎng)絡(luò)請求學(xué)習(xí)記錄

常見post數(shù)據(jù)格式

四種常見post的數(shù)據(jù)格式

FormData對象的使用

FormData對象的使用官方文檔

FileReader對象的使用

FileReader官方文檔

Form表單對象的使用

Form官方文檔
表單提交:事件和方法提交
Form表單&FileReader:文件的上傳和讀取

input type = ‘file’

HTMLElement官方文檔
input type = 'file'相關(guān)屬性官方文檔介紹

submit方法的使用

submit官方文檔

使用web應(yīng)用中的文件

Using files from web applications

Using XMLHttp?Request

AJax入門官方文檔
用XMLHttpRequest 發(fā)送表單信息、上傳文件
Ajax請求($.ajax()為例)中data屬性傳參數(shù)的形式

Array數(shù)組相關(guān)的使用

array官方文檔

A brief introduction to the submit methods

An html <form> can be sent in four ways:

  • using the POST method and setting the enctype attribute to application/x-www-form-urlencoded (default);
  • using the POST method and setting the enctype attribute to text/plain;
  • using the POST method and setting the enctype attribute to multipart/form-data;
  • using the GET method (in this case the enctype 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.
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • rljs by sennchi Timeline of History Part One The Cognitiv...
    sennchi閱讀 7,841評論 0 10
  • Data Visualization with D3 D3: SVG中的jQurey 1. Add Documen...
    王策北閱讀 872評論 0 2
  • Correctness AdapterViewChildren Summary: AdapterViews can...
    MarcusMa閱讀 9,051評論 0 6
  • 第七期第2篇 饑腸轆轆的完成這篇寫作,看到時光倒流,我就想到了他,一個高中同學(xué)。坐著時光機,快快回到那一天吧。他牽...
    潔兒潔兒潔兒閱讀 119評論 1 1

友情鏈接更多精彩內(nèi)容