我有一個jQuery函數是這樣的:爲什麼.ajaxError會執行兩次?
<script type="text/javascript">
$(document).ajaxError(function() {
// Show only an alert();
alert("An error occurred. Please try again after some time.");
})
</script>
被觸發呼叫按鈕:
<p:commandButton id="deleteButton"
value="Delete Urls"
styleClass="action-button"
actionListener="#{controller.deleteUploadedUrls}"
immediate="true"
update="btnPanel messages"
oncomplete="view.disableNextTabs();"/>
的問題是,該警報顯示兩次。
爲什麼警報顯示兩次?
提交兩個AJAX請求?不可能說給你的極其模糊的代碼示例。 – Madbreaks
你在頁面內進行多個ajax調用嗎? – Jason
它會顯示兩次,因爲兩個ajax請求或失敗,或者您綁定了兩次事件。 –