var data=xmlHttp.responseXML;
alert(data);
目的是查看servlet是否有返回来的信息,确定js关联对了servlet
2.如果有弹出类似
---------------------------
来自网页的消息
---------------------------
<china>
<province name='???'>
<city>??</city>
<city>???</city>
<city>??</city>
<city>??</city>
<city>??</city>
</province>
<province name='???'>
<city>??</city>
<city>??</city>
<city>??</city>
<city>??</city>
<city>??</city>
</province>
<province name='???'><city>??</city><city>??</city><city>??</city><city>??</city><city>??</city></province></china>
---------------------------
确定
---------------------------
证明关联setvlet是正确的..
那么就看servlet中有没有response.setContentType("text/xml;charset=utf-8");它的作用是告诉浏览器返回的是xml文档格式的内容
原文链接:https://www.f2er.com/ajax/166860.html