建议使用jQuery,跟操作html一样,伪代码如下:
$.ajax({ url: '/xml/Student.xml', type: 'GET', dataType: 'xml', success: function(xml) { var name = $(xml).find('name').text(); $('h1').text(name); }});
ajax载入xml