javascript - XmlHttpRequest 与 asp.net

标签 javascript asp.net internet-explorer web xmlhttprequest

我尝试向我的 ashx 文件发送获取请求。但是我遇到了字符问题。
问题是当我通过 firefox 或 crome 发送请求时没有问题,但是当尝试使用 IE 发送时我无法
得到我发送的内容。我发送“Ç”字符,但在服务器端我无法获取它。

myRequest.open("GET", "/Search.ashx?SearchText=" + search + "", true);
myRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
myRequest.send(null);

最佳答案

您似乎还没有使用 javascript 使用 encodeURIComponent 函数对“搜索”字符串进行编码。在 ashx 端,您可以使用 HttpUtility.HTMLDecode 方法来解码您的字符串。

关于javascript - XmlHttpRequest 与 asp.net,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15830060/

相关文章:

javascript - 如何在倒计时结束后显示图像?

javascript - 移动标题不可点击

c# - 当用户推送 "Edit"链接时,如何将下拉列表框放在 GridView 列中?

jquery - Internet Explorer : Bad visualization of CSS Table (table-row, 表格单元格)

javascript - "Function declarations cannot be nested inside a statement"- IE 处于严格模式错误

Javascript 停止在 MeteorJS 中进行硬页面重新加载

javascript - 尝试通过类名获取多个 <span> 元素并将其值更改为 true 或 false

asp.net - 流式上传时获取上传文件的名称

Asp.Net 网页网站 - 如何添加 Web Api Controller

internet-explorer - IE 中不换行(flexbox)