我使用mootools从网络服务获取响应
onSuccess: function (responseText) {
alert(responsetext);
}
作为答案我得到了
<?xml version="1.0" encoding="utf-8"?>
<int xmlns="http://estimomini">15</int>
我如何才能获得字符串AKA 15?
答案 0 :(得分:1)
如果您知道XML文档将始终如下所示,请尝试
onSuccess: function(responseText, responseXML) {
alert(responseXML.documentElement.firstChild.data);
}
答案 1 :(得分:0)
<script>
window.addEvent('domready', function(){
var req = new Request({
url: 'data.xml',
method: 'get',
onSuccess: function(responseText, responseXML) {
var tempDiv = new Element('div', {html: responseText});
var myInt = tempDiv.getElement('int').get('text');
alert(myInt);
}
}).send();
});
</script>