Eric的使用XMLHTTP从服务端取得数据演示

来源:互联网 发布:杨众国 知乎 编辑:程序博客网 时间:2024/04/30 16:18


使用XMLHTTP从服务端取得数据

在服务器直接使用Request.Form取值, 不需要另外解码编的, 无中文显示问题
适用于所有CGI服务端

服务端代码: ASP.NET with C# 版, 改成其它版本很容易, 我就不浪费时间了:]

<%@ Page Language="C#" %>
<%
string result = "";

for(int i = 0; i < Request.Form.Count; i++)
{
    result 
+= Request.Form.GetKey(i) + "=" + Request.Form.Get(i) + "&";
}


if(result == "")
{
    result 
= "Empty Request!";
}

else
{
    result 
= result.Substring(0, result.Length - 1);
}


Response.Write(
"Server Requested: " + result);
%>
原创粉丝点击