jQuery(或其他库?)基本上将为您完成所有这些工作。我强烈建议您对此进行研究,而不要重新发明轮子。
进行查询可能需要:
// Make a call to url, with data $.ajax( { url: $url, data: $data, dataType: 'xml', callback: function(returnData) { // Jquery find <mytag attribute="foo">...</mytag> and store it in mydata var mydata = $(returnData).find('mytag[attribute=foo]'); // Insert into current page to somewhere with $('.after-me').html(mydata); }});我可能语法错误。但是这里是文档:http :
//docs.jquery.com/Ajax/jQuery.ajax#options



