Stuck with "Loader" while deleting items. I have a set of items to delete and need to display a loader image while deleting. But, for some reason, i'm not able to solve this. I have came across different solutions and implemented it hoping it will solve the issue. But, no luck. Below were the solutions i implemented.
- AjaxStart, AjaxStop methods
- SetTimeout(function(){},0);
- jQuery.ajaxSetup({beforeSend:function(),complete()})
- fadeIn,Fadeout methods
I have used the below code as synchronous...
$(document).ready(function(){
$('#callLoader').hide();
$('#btndelete').click(function(){
$('#callLoader').show();
setTimeout(function() {
$.ajax({
url: _spPageContextInfo.webAbsoluteUrl + "/_api/web/lists/getByTitle('12kListItems')/items?$top=9999",
},beforeSend: function () {
$('#callLoader').show();
},
success: function (data) {
var items = data.d.results;
var counter = 0;
for (var i = 0; i < data.d.results.length; i++) {
if(data.d.results[i].Id != undefined){
//storage.push(data.d.results[i].Id);
$('#DisplayCounter').text(i);
}
}
setTimeout(function(){
$('#callLoader').hide();
},1000);
},
async:false,
error: function (error) {
console.log(JSON.stringify(error));
}
})
;}, 0);
$('#callLoader').hide();
});
});
"callLoader" is a Div tag
setTimeOutfor both the occurrence. If you can tell the exact behavior may be we can help.