ziyoublog

发送json格式数据

xhr.setRequestHeader("Content-type","application/json; charset=utf-8");

发送表单数据

xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded; charset=utf-8");

发送纯文本

不指定Content-type时,此是默认值值

xhr.setRequestHeader("Content-type", "text/plain; charset=utf-8");

发送html文本

xhr.setRequestHeader("Content-type", "text/html; charset=utf-8");

编码可带可不带

// 不带字符编码写法
xhr.setRequestHeader("Content-type", "application/json");

值对大小写不敏感

xhr.setRequestHeader("Content-type","Application/JSON; charset=utf-8");

分类:

技术点:

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-11-11
  • 2021-08-11
  • 2021-12-03
  • 2021-04-14
  • 2021-04-12
  • 2022-12-23
猜你喜欢
  • 2021-06-21
  • 2022-02-28
  • 2022-12-23
  • 2022-12-23
  • 2021-10-07
  • 2021-05-18
  • 2022-12-23
相关资源
相似解决方案