我使用 mootools 从网络服务获取响应
onSuccess: function (responseText) {
alert(responsetext);
}
作为我得到的答案
<?xml version="1.0" encoding="utf-8"?>
<int xmlns="http://estimomini">15</int>
我如何只得到字符串 AKA 15 ?
我使用 mootools 从网络服务获取响应
onSuccess: function (responseText) {
alert(responsetext);
}
作为我得到的答案
<?xml version="1.0" encoding="utf-8"?>
<int xmlns="http://estimomini">15</int>
我如何只得到字符串 AKA 15 ?
如果您知道 XML 文档将始终如下所示,请尝试
onSuccess: function(responseText, responseXML) {
alert(responseXML.documentElement.firstChild.data);
}
<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>