我有一个显示平均等待时间的 xml 文件。我需要使用 jquery 和 ajax(或其他技术,如果这是更好的解决方案)读取该文件并将其显示在 html 页面中。我需要从节点中提取数据。我还需要将这些数据转换为对读者更友好的格式。所以 0:06 将显示 6 分钟,而 1:06 将显示 1 小时 6 分钟。
我试过这段代码没有成功:
$(document).ready(function(){
$.ajax({
type: "GET",
url: "http://www.citizensmemorial.com/Temp/edwaittimes.xml",
dataType: "xml",
success: function(xml) {
$(xml).find('edWait').each(function(){
var time = $(this).attr('AverageWait');
$('+time+');
});
}
});
});