導出按鈕點擊後添加高亮樣式,需在請求**無論成功失敗**結束時移除。
僅在 `success` 移除,若請求失敗/異常則樣式殘留。
$.ajax({
url: '/Report/ExportReport',
data: { ... },
beforeSend: () => { $('.expIcon').addClass('expIcon_select'); isShowload(1); },
complete: () => {
$('.expIcon').removeClass('expIcon_select'); // 統一移除
isShowload(0);
},
success: (data) => { window.location = '/DownFile/Downfile?name=' + escape(data.path); }
});`beforeSend` → `success`/`error` → `complete`。`complete` 保證最後執行,適合清理 Loading、恢復按鈕狀態。