Hello, good morning.
I'm having my application here in the following question.
I have the index.html page,
on this page I have a <div>
to display loading as per the code below:
<div id="loader" style="display: none;"> <img src="loading.gif" align="center" width="200" height="180">Carregando...</div>
Now I have the .js file
function onCarregaFunVeiEqu () {
$.ajax({
url: ''''''''getFun.php'''''''',
type: ''''''''get'''''''',
async: false,
beforeSend: function(){
$("#loader").show();
$("#loader").css({display:"block"});
},
success: function(response){
var obj = JSON.parse(response);
obj.forEach(function (o, index) {
onSincFun(o.cdfun, o.nmfun, o.nusen, o.nmatri);
});
$.ajax({
url: ''''''''getVei.php'''''''',
type: ''''''''get'''''''',
async: false,
success: function(response){
var obj = JSON.parse(response);
obj.forEach(function (o, index) {
onSincVei(o.cdve, o.nuplaca, o.detip, o.demdl);
});
$.ajax({
url: ''''''''getEquipe.php'''''''',
type: ''''''''get'''''''',
async: false,
success: function(response){
DeleteEqu();
var obj = JSON.parse(response);
obj.forEach(function (o, index) {
onSincEqu(o.cdequ, o.deequ, o.dearea, o.nmobra);
});
}
});
}
});
},
complete: function(data){
//$("#loader").hide();
}
}).always (function() {
$("#loader").show();
$("#loader").css({display:"block"});
}).done (function() {
$("#loader").hide();
$("#loader").css({display:"none"});
});
}
What happens is:
Loading ... it appears, but it already disappears ... and meanwhile he is synchronizing .. ie he had to synchronize EVERYTHING to later disappear Loading ...
Does anyone have a suggestion?