zoukankan      html  css  js  c++  java
  • 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

  • 相关阅读:
    机器学习
    octave安装使用
    学习pytorch
    安装Pytorch
    下载软件的好地方
    python 内置模块time timedate random
    关于git
    python软件目录结构规范
    python 内置参数
    test
  • 原文地址:https://www.cnblogs.com/ashen1999/p/12559627.html
Copyright © 2011-2022 走看看