I have the following function:
function submitForCorrection() {
try {
$("#uploadSpinner").removeClass("hidden");
setTimeout(function() {}, 100);
SubmitForm('BoqReviewForm',
'boqReviewTable',
'@Url.Action("PostBoqFlags", "ProjectAuthority")',
'@Url.Action("GetBoqReview", "ProjectAuthority")',
function() { showNotification('Correction requested.', 'success'); },
null,
'Requesting correction. Please wait',
false);
} finally {
$("#uploadSpinner").addClass("hidden");
}
}
The SubmitForm
call is rather timeous, hence me wanting to show a 'spinner' while it executes. Yet it's as if my
$("#uploadSpinner").removeClass("hidden");
line of code is totally ignored.
I know the spinner is in the correct place, because if I put a breakpoint on the removeClass
line and manually remove the hidden
class in Chrome dev tools, the spinner shows up exactly where I want it.
I've added the setTimeout(function() {}, 100);
in the vain hope that removing the hidden
class may take some time, and I wanted to avoid the SubmitForm
call executing before the spinner is visible.
Why is my code behaving as if the removeClass
isn't even there?
Aucun commentaire:
Enregistrer un commentaire