jquery獲取XML節(jié)點名稱的幾種方法以:
• get(0).tagName
$(this).get(0).tagName
• [0].tagName[0]
$(this)[0].tagName
• context.nodeName
$(this).context.nodeName
function getXMLData(){ $.ajax({ url:'data.xml', type: 'GET', dataType: 'xml', timeout: 1000, error: function(xml){ alert('Error loading XML document'+xml); }, success: function(xml){ $("data",xml).children().each(function(){ alert($(this).context.nodeName); }); } }); }
以上這篇jquery解析XML及獲取XML節(jié)點名稱的實現(xiàn)代碼就是小編分享給大家的全部內(nèi)容了,希望能給大家一個參考,也希望大家多多支持武林網(wǎng)。
新聞熱點
疑難解答