大家好我在我的项目中使用过装载机图标它工作正常但很少有地方点击按钮时需要1-2秒才能显示
我找到了很多与此相关的答案
show-loading-image-while-ajax-is-performed
但我的问题仍然存在
加载图标无法点击& Ajax电话请查看以下代码以供参考。
$("#delyesRemoveAccountCode").click(function () {
//Loader is appearing after 2 second if i am using setTimeout function,
setTimeout(function () {
overlayFull("show");
}, 200);
//this is executing loader throughout whole application but here it's not working
overlayFull("show");
var objDelete = {
"CostItemId": null,
"ComparableAccountCodeId": accountCodeId,
"CBSCode": null,
"Description": null,
"Cost": null,
"ManHours": null,
"Quantity": null,
"UnitOfMeasureValue": null,
"UnitRate": null,
"ModifiedDate": null,
"AccountCodes": []
};
$("#costDetailgrid tr td input").each(function (index) {
if ($(this).val().match(code) && $(this).val().trim().indexOf(code) == 0) {
var accountCodesArray = {
"AccountCodeId": 0,
"AccountLevel": 0,
"Code": "0",
"DisciplineId": 0,
"ParentAccountCodeId": 0,
"AccountId": 2,
};
accountCodesArray.Code = $(this).val().trim();
accountCodesArray.AccountCodeId = $(this).data('accountcodeid');
objDelete.AccountCodes.push(accountCodesArray);
}
});
// overlayFull("show");
$.ajax({
async: false,
url: remoteServername + 'odata/CostItemSaveAs(' + comparableID + ')',
data: objDelete,
// beforeSend: function () {
// overlayFull("show");
// },
error: function (XMLHttpRequest, textStatus, errorThrown) {
console.log(textStatus, errorThrown);
overlayFull("hide");
},
dataType: 'json',
success: function (resp) {
if (comparableID != null) {
$("#costDetailgrid tr.costItemEditRow,#costDetailgrid tr.costItemAddRow").each(function () {
$(this).remove();
});
costdetailTreeListLoad();
setTimeout(function () {
overlayFull("hide");
}, 1000);
ComTreeList.ResetTreeList('mngRecordCostDetailsTreeList', 'mngRecordCostDetailsTreeListSelectedTab');
}
else {
$(".norecordSecrion").show();
$("#costDetailgrid").hide();
}
},
type: 'PATCH'
})
});