Get讀取與Post傳送比較與傳送原理


Posted by hoyi-23 on 2021-05-24

Get讀取 與 Post傳送 比較

Get 流程

  1. 於瀏覽器上開啟 XMLHttpRequest的請求
  2. 送出請求send(null)
  3. 資料庫於ResponseText回傳資料
    ### Post 流程
  4. 於瀏覽器上發出 XMLHttpRequest的請求
  5. 設計傳算post的格式:
    content-type,application/x-www-form-urlencoded (一般表單格式)
  6. 送出請求('...&...')
  7. 資料庫於ResponseText回傳資料

    格式不同傳送內容的方式也會不同
    下圖格式:
    content-type,application/json

格式需與後端配合

從 Chrome 開發人員工具檢視 AJAX POST

使用chrome就可以檢查是否傳送成功以及傳送的內容。

  1. 開啟Network

    我們可以看到載入的類別
  2. 點入xhr


    可以看到是否 傳送成功 以及 傳送的內容 等傳送資料。









Related Posts

由下到上:從 TCP/IP 開始談起

由下到上:從 TCP/IP 開始談起

[python] 關於python三兩事 - class,  __init__,   __call__

[python] 關於python三兩事 - class, __init__, __call__

[Python] Create an API with Flask and test with pytest

[Python] Create an API with Flask and test with pytest


Comments