AJAX请求头Content-type
发布时间:2020-12-16 03:03:55 所属栏目:百科 来源:网络整理
导读:发送json格式数据 xhr.setRequestHeader( "Content-type", "application/json; charset=utf-8"); 发送表单数据 xhr.setRequestHeader( "Content-type", "application/x-www-form-urlencoded; charset=utf-8"); 发送纯文本 不指定Content-type时,此是默认值
发送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");
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |