我使用這樣的結構:jQuery的ajaxStart
$('#wait').ajaxStart(function() {
if ($(this).not(':visible'))
$(this).showWarning();
}).ajaxComplete(function() {
if ($(this).is(':visible'))
$(this).hideWarning();
}).ajaxError(function() {
alert('Unexpected error...');
});
我想禁用每次用戶點擊它時提交按鈕。爲了使它通用 - 我想在ajaxStart方法中做到這一點,那麼有沒有辦法獲得初始化請求的按鈕ID? 謝謝
你可以使用全局變量來保存按鈕的ID並在ajaxStart函數中使用它。 – 2012-04-04 05:59:31
你可以將按鈕點擊事件傳遞給函數嗎? – Subodh 2012-04-04 06:01:12
@sub_stantial:你是什麼意思?我應該通過按鈕點擊事件的功能? – nKognito 2012-04-04 06:03:54