//導出
$("#export").click(function () {
$(".expIcon").addClass("expIcon_select");
$(".expIcon+span").css({ "color": "#5789DF" });
if (type != 1) {
alert("請先保存或取消後再導出!");
$(".expIcon").removeClass("expIcon_select");
$(".expIcon+span").css({ "color": "#555" });
return;
}
var StartTime = $("#StartTime").val();
$.ajax({
url: '/Report/ExportReport',
data: { "StartTime": StartTime, "ReportType": 15, "HolidayId": 8 },
dataType: "json",
type: "Post",
beforeSend: function () {
isShowload(1);
},
complete: function () {
isShowload(0);
},
success: function (data) {
//獲取到的文件名先進行轉碼再使用,否則可能亂碼
var path = escape(data.path);
window.location = "/DownFile/Downfile?name=" + path + "&reporttype=15";
}
});
});
在 complete回調中移除
complete事件是不管成功與否都執行,success只有正確返回(200狀態並且是標准json格式字符串才會執行,所以不敢保證正執行到success
complete: function () {
$(".expIcon").removeClass("expIcon_select");////////////////
isShowload(0);
}