4
Well I make a request via AJAX, so I can put a load on the screen and remove it when AJAX loads the page.
The problem is that I need to make the load appear only if the request takes more than 2 seconds.
I’m doing like this:
$(document).ready(function () {
$(".loading").show();
$.ajax({
url: 'APP?pagina=<?= $pagina ?>',
success: function (response) {
$("#app").html(response);
$(".loading").hide();
}
});
});
loading
is the DIV that counts the loading, and it can only appear if the request takes more than 2 seconds.
Does anyone know how to do that?
you know the timeout?
– durtto
Yes I tried to use it here but it was going wrong, because the div was appearing after 2 Monday and did not leave the screen more. I guess I wasn’t doing it right
– Hugo Borges