日期:2014-05-16  浏览次数:20573 次

如何用responseText接收一个xml格式的字符串?
大家新年好,问个问题。
AJAX如何接收一个xml形式的字符串?
比如服务端返回的是
"<abc><aaa>AJAX</aaa></abc>"
我想在客户端接收的也是上面这个字符串.


------解决方案--------------------
你设置response.ContentType="text/plain"
返回的结果就可以直接使用responseText接收了
------解决方案--------------------
你是怎么写的代码啊,很简单啊

1.htm

HTML code
<script>
x = window.XMLHttpRequest?new XMLHttpRequest():new ActiveXObject("MSXML2.XMLHTTP");
x.open("GET","a.asp",false)
x.send(null);
alert(x.responseText)
</script>