我有此位的代码而使用显示从XML提要一些地方AJAX:AJAX - 在页面刷新双重结果
它显示正确,但$.ajax({
type: "GET",
url: "testxml.xml",
dataType: "xml",
success: function(xml) {
$(xml).find("Country[Name='"+localStorage.ArrivalCountry+"']").find('Destination').each(function(){
var destinationName = $(this).attr('Name');
$('<a class="listItem" href="#" id="'+destinationName+'">'+destinationName+x+'<div class="arrow"></div></a>').appendTo('#destinationList');
});
}
});
第一次,如果我刷新页面,它会显示每个结果两次。如果我再次执行,则会显示三次,依此类推。
那么你的Ajax调用返回???给我们一个例子.. – 2012-02-19 16:27:45