如何强制XMLHttpRequest仅使用ISO-8859-1字符集? [英] How to force XMLHttpRequest to use ISO-8859-1 charset only?

查看:128
本文介绍了如何强制XMLHttpRequest仅使用ISO-8859-1字符集?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有ISO-8859-1数据库,所以我喜欢在这个代码页中完全交换请求。那么,如何以正确的方式设置AJAX请求的内容类型?

I have ISO-8859-1 database, so I like to exchange requests entirely in this codepage. So, how to set content-type for AJAX requests in the right way?

推荐答案

即使这样做不好评论如下),这将工作:

Even though it's bad to do (bunch of comments above), this would work:

var xhr = new XMLHttpRequest(); 
xhr.open("GET", path, false);
xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded; charset=ISO-8859-1')

如果您使用的是jQuery: https://stackoverflow.com/a/553572 / 2527433

If you are using jQuery: https://stackoverflow.com/a/553572/2527433

这篇关于如何强制XMLHttpRequest仅使用ISO-8859-1字符集?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆