你可以把xml内容作为普通的文本传回:
var xml = @"
select * from table
]]>
";
Response.Write(xml);
这样在前台:
$.get("Handler1.ashx",
{
"r": Math.random(),
"其他参数": "参数值"
},
function (strXml) {
alert(strXml);
}
);
strXml就是xml的内容了。
context.Response.ContentType = "application/xml";
System.Text.StringBuilder sb = new System.Text.StringBuilder();
sb.Append("
sb.Append("
sb.Append("
context.Response.Write(sb.ToString());
context.Response.End();