【swans】:
function get_area_Result_CallBack(response)
{
if (response.value != null)
{
document.all("DropDownList3").length=0;
var ds = response.value;
if(ds != null && typeof(ds) == "object" && ds.Tables != null)
{
for(var i=0; i<ds.Tables[0].Rows.length; i++)
{
var name=ds.Tables[0].Rows
.area;
var id=ds.Tables[0].Rows
.areaID;
document.all("DropDownList3").options.add(new Option(name,id));
}
}
}
return
}
【Michelle_Z】:
谢谢cansum396(沉觉不醒):返回的DataTable应该就是XML格式的数据了吧,可是怎么再操作这个XML数据呢?怎么样才能看到返回的DataTable的具体数据和格式呢?
谢谢swans(swan.net) :你的例子中“area”,“areaID”是不是列名呀?
可我是希望在不知道列名的情况下(如返回的DataTable可能是不同的数据集),使用列的下标来访问列。
【xiaokeai12925】:
C#: DataSet ds = new DataSet("表名");
da.Fill(ds);
XmlTextWriter writer = new XmlTextWriter(Response.OutputStream, Response.ContentEncoding);
writer.Formatting=Formatting.Indented;
writer.Indentation=4;
writer.IndentChar=' ';
ds.WriteXml(writer);
js:
var oHttpReq = new ActiveXObject("MSXML2.XMLHTTP");
var oDoc = new ActiveXObject("MSXML2.DOMDocument");
oHttpReq.open("POST", "eatabout_recive.aspx?state="+str[0], false);
oHttpReq.send("");
result = oHttpReq.responseText;
oDoc.loadXML(result);
items = oDoc.selectNodes("//表名/Table");
var cc=items[0].selectSingleNode("字段").text