我有此位的代碼而使用顯示從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