ajax中设置header的Content-Type两种类型区别

post给服务器的数据类型是string,content-type有两种类型

1、application/json

发送给服务器的数据,会对数据进行JSON序列化

2、application/x-www-form-urlencoded

发送给服务器的数据,会将数据转化成query string,在浏览器network里参数会放到Form Data里


也就是说,content-type使用哪种类型,区别于服务器是怎么解析数据的。

猜你喜欢

转载自blog.csdn.net/ppx2017/article/details/80616614