Server - AjaxProcessor.aspx :
XmlDocument doc = new XmlDocument();
doc.**** // manipulate data in doc, include Insert, Remove or Replace
//begin output to client
Response.Clear();
Response.Write(doc.InnerXml);
Response.End();
Client - Ajax
var request = new XMLHttpRequest();
request.onreadystatechange=callback;
request.open("Get","AjaxProcessor.aspx",true);
request.send(null);
function callback()
{
if(request.readyState==4)
if(request.status==200)
alert(request.responseText); //Get XML format data here
}
Example of DOM
Server - AjaxProcessor.aspx :
XmlDocument doc = new XmlDocument();
doc.**** // manipulate data in doc, include Insert, Remove or Replace
//begin output to client
Response.ContentType = "text/xml";
Response.Clear();
Response.Write(doc.InnerXml);
Response.End();
Client - Ajax
var request = new XMLHttpRequest();
request.onreadystatechange=callback;
request.open("Get","AjaxProcessor.aspx",true); request.send(null);
function callback()
{
if(request.readyState==4)
if(request.status==200)
{
var info =
request.responseXML.getElementsByTagName("age")[0].text;
alert(info);
}
}
posted on 2007-07-06 11:29
GuangMing Lan 阅读(154)
评论(0) 编辑 收藏 引用