• ajax请求方式及注意事项


     post

    POST 请求过程中,都是采用请求体承载需要提交的数据 写在send函数中 如:param1=value1&param2=value2

    因为此时请求体是urlencoded格式,所以要将请求头的Content-Type设置为application/x-www-form-urlencoded

     get

    通常在一次 GET 请求过程中,参数传递都是通过 URL 地址中的 ? 参数传递。

    通常无需设置请求体,即send()函数中为null

    注意事项

    一旦请求体是urlencoded格式的内容,一定要设置请求头中的content-Type为application/x-www-form-urlencoded,否则服务器无法解析。

    请求头中的content-Type应该根据我们所要请求的数据格式变化

    当表单的enctype设置为multipart/form-data时,其请求体会变成request payload 正常情况下是form-data

  • 相关阅读:
    20220531复盘
    20220606复盘
    20220607复盘
    20220601复盘
    20220608复盘
    re模块
    os模块
    openpyxl模块
    list
    vim配置与操作
  • 原文地址:https://www.cnblogs.com/ashen1999/p/12559627.html
Copyright © 2020-2023  润新知