0
我正在使用EXTjs並嘗試通過ajax連接到服務器並以xml格式獲取輸出。有3個文本框需要填充這些xml值使用extjs將responseText中的值分配給文本框
response.responseText給我的結果,但response.responseXML給出null。有什麼方法可以將responseText轉換爲responseXML,然後將值分配給文本框。 有人可以幫我嗎?
function getXML(){
Ext.Ajax.request({
url : 'url',
params : {
method : 'runxml'
},
method : 'POST',
success : function(response, options) {
alert(response.responseXML);
alert(response.responseText);
},
failure : function(response, options) {
Ext.MessageBox.show({
title : 'Error On retrieve value from server',
msg : 'An error occur during retrieve value from server',
buttons : Ext.MessageBox.OK,
icon : Ext.MessageBox.ERROR,
width : 400
});
},
disableCaching : true
});
}
}
,我從response.responseText得到的輸出是
<wddxPacket version='1.0'><header/>
<data><string><?xml version="1.0" encoding="iso-8859-1" ?>
<char code='0a'/><TABLE>
<char code='0a'/><LIMITS>
<char code='0a'/><UCL> 5.23145 </UCL>
<char code='0a'/><CTL> 3.0269 </CTL>
<char code='0a'/><LCL> 1.458</LCL>
<char code='0a'/></LIMITS>
<char code='0a'/></TABLE>
<char code='0a'/></string></data></wddxPacket>
使用firebug我可以看到響應內容類型爲text/html。我無法訪問服務器,因此無法將其設置爲text/xml。這是否有任何其他說服力? – user1049057