0
在我寫了一個代碼...IE7/8重複Ajax請求
function change_regione(handle) {
// Hiding selects that we don't need
jQuery("select#comune").hide();
jQuery("select#quartiere").hide();
if(jQuery("#regione").val() == '') {
jQuery("select#provincia").parent().hide();
return
}
jQuery.ajax({
url : WEBSITE_PATH + 'loadProvince.php',
type : 'GET',
dataType: 'json',
data : {
search_value : jQuery("#regione option:selected").attr("rel")
},
success : function(result) {
var provinceOptions = "<option value=\"\">Tutte le province</option>";
jQuery.each(result,function(i,el){
provinceOptions += '<option value="'+ el.url +'" rel="'+ el.id +'">' + el.value.replace("~","") + '</option>';
});
jQuery("select#provincia").parent().show();
jQuery("select#provincia").html(provinceOptions).show();
},
error : function(request, status, error) {
}
});
}
IE7/8啓動AJAX請求兩次了選擇的onchange()事件。
<select id="regione" name="regione" class="srhbox" onchange="change_regione(this)">
...
</select>
Firefox,Safari,Chrome,表現正確。
發生了什麼事?你見過這種行爲嗎?
請求被證明根據Apache日誌將推出兩次...... – Napolux 2011-12-14 15:16:32
我還沒有看到過,但我也從來沒有使用`平變化=「...」`。如果你使用jQuery來綁定使用`.bind``.on`或`.change`的事件,我不認爲你會看到這個問題。 – 2011-12-14 15:17:36