我使用$.get()
向URL發送請求。響應文本返回與下面的XML:從jquery ajax的XML格式化響應讀取值
<?xml version="1.0" encoding="UTF-8" ?>
<myNode>
<cmd>Requested Item</cmd>
<myValue>this is the text i need to get with jquery</myValue>
<res>OK</res>
</myNode>
我需要得到<myValue>
和</myValue>
標籤上的文字:
<myValue>this is the text i need to get with jquery</myValue>
我曾嘗試在$獲得()函數下面的代碼:
$.get(url,function(xml){
var x, i, attnode, xmlDoc, txt;
xmlDoc = xml.responseXML;
x = xmlDoc.getElementsByTagName('data');
}
但是在變量x
中沒有值。
精彩的解決方案。謝謝。 –
我的榮幸:)祝你好運.. –