xmlHttp.responseText返回值
请高手帮忙看下xmlHttp.responseText为什么只能返回不能内容,中间页面stringstr="";stringconnstr=ConfigurationMa...
请高手帮忙看下xmlHttp.responseText为什么只能返回不能内容,
中间页面
string str = "";
string connstr = ConfigurationManager.ConnectionStrings["DistanceEduConnectionString"].ConnectionString;
SqlConnection conn = new SqlConnection(connstr);
try
{
string sql = "select * from [User]";
SqlDataAdapter sda = new SqlDataAdapter(sql, conn);
DataSet ds = new DataSet();
sda.Fill(ds);
DataTable dt = ds.Tables[0];
for (int i = 0; i < dt.Rows.Count; i++)
{
str += dt.Rows[i]["UserID"].ToString() + ":";
str += "=";
}
Response.Write(str);
ApplicationInstance.CompleteRequest();
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
finally
{
conn.Close();
conn.Dispose();
}
返回:100000000000:=1111111:=12340120521:=12340152904:=12340163209:=12340166270:=12340183208:=123401847491:=123456789012:=123456789013:=123456789123:=41:=57:=7:=96:=
js
//声明XMLHttpRequest对象
var xmlHttp;
function CheckName() {
createXMLHTTP(); //创建XMLHttpRequest对象
var url = "DisposeEvent.aspx?Event=Check";
xmlHttp.open("GET", url, true);
xmlHttp.onreadystatechange = selectInfo;
xmlHttp.send(null);
}
function createXMLHTTP() {
if (window.XMLHttpRequest) {
xmlHttp = new XMLHttpRequest(); //mozilla浏览器
}
else if (window.ActiveXObject) {
try {
xmlHttp = new ActiveXObject("Msxml2.XMLHTTP"); //IE老版本
}
catch (e)
{ }
try {
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); //IE新版本
}
catch (e)
{ }
if (!xmlHttp) {
window.alert("不能创建XMLHttpRequest对象实例!");
return false;
}
}
}
function selectInfo() {
if (xmlHttp.readyState == 4)//判断对象状态
{
if (xmlHttp.status == 200)//信息成功返回,开始处理信息
{
var result = document.getElementById("Label1");
result.innerHTML = xmlHttp.responseText;
}
}
}
返回:100000000000:=1111111:=12340120521:=12340152904:=12340163209:=12340166270:=12340183208:=123401847491:=123456789012 请问是怎么回事,只获取到了一半的内容,谢谢。 展开
中间页面
string str = "";
string connstr = ConfigurationManager.ConnectionStrings["DistanceEduConnectionString"].ConnectionString;
SqlConnection conn = new SqlConnection(connstr);
try
{
string sql = "select * from [User]";
SqlDataAdapter sda = new SqlDataAdapter(sql, conn);
DataSet ds = new DataSet();
sda.Fill(ds);
DataTable dt = ds.Tables[0];
for (int i = 0; i < dt.Rows.Count; i++)
{
str += dt.Rows[i]["UserID"].ToString() + ":";
str += "=";
}
Response.Write(str);
ApplicationInstance.CompleteRequest();
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
finally
{
conn.Close();
conn.Dispose();
}
返回:100000000000:=1111111:=12340120521:=12340152904:=12340163209:=12340166270:=12340183208:=123401847491:=123456789012:=123456789013:=123456789123:=41:=57:=7:=96:=
js
//声明XMLHttpRequest对象
var xmlHttp;
function CheckName() {
createXMLHTTP(); //创建XMLHttpRequest对象
var url = "DisposeEvent.aspx?Event=Check";
xmlHttp.open("GET", url, true);
xmlHttp.onreadystatechange = selectInfo;
xmlHttp.send(null);
}
function createXMLHTTP() {
if (window.XMLHttpRequest) {
xmlHttp = new XMLHttpRequest(); //mozilla浏览器
}
else if (window.ActiveXObject) {
try {
xmlHttp = new ActiveXObject("Msxml2.XMLHTTP"); //IE老版本
}
catch (e)
{ }
try {
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); //IE新版本
}
catch (e)
{ }
if (!xmlHttp) {
window.alert("不能创建XMLHttpRequest对象实例!");
return false;
}
}
}
function selectInfo() {
if (xmlHttp.readyState == 4)//判断对象状态
{
if (xmlHttp.status == 200)//信息成功返回,开始处理信息
{
var result = document.getElementById("Label1");
result.innerHTML = xmlHttp.responseText;
}
}
}
返回:100000000000:=1111111:=12340120521:=12340152904:=12340163209:=12340166270:=12340183208:=123401847491:=123456789012 请问是怎么回事,只获取到了一半的内容,谢谢。 展开
1个回答
2016-01-16
展开全部
15*15=225
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询