现在的位置: 首页 > 综合 > 正文

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

2013年06月24日 ⁄ 综合 ⁄ 共 425字 ⁄ 字号 评论关闭

使用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);
%>

抱歉!评论已关闭.